id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11669,lexical_cast crashes on certain conditions for floating point types,alday.boost.trac@…,Antony Polukhin,"In the presence of BOOST_LCAST_NO_COMPILE_TIME_PRECISION, there is no specialization of lcast_src_length for floating types, so lexical_converter_impl will allocate only 2 bytes and then try to do a sprintf, making the program crash. While the specialization for integral types checks for the presence of BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS, and ifdefs an arbitrary value or one calculated via std::numeric_limits, the specialization for floats gets wiped out completely in the presence of BOOST_LCAST_NO_COMPILE_TIME_PRECISION. Could you please do for floats what you do for integrals? I attach a patch that assigns an (arbitrary) max length of 156 to the representation of floats. Basically, instead of {{{ #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION template struct lcast_src_length >::type> { ... BOOST_STATIC_CONSTANT(std::size_t, value =5 + lcast_precision::value + 6); }; #endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION }}} I'd like to move the ifndef inside, as in {{{ template struct lcast_src_length >::type> { #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION ... BOOST_STATIC_CONSTANT(std::size_t, value =5 + lcast_precision::value + 6); #else BOOST_STATIC_CONSTANT(std::size_t, value = 156); #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION }}} The easiest way to reproduce it is: {{{ #include #define BOOST_LCAST_NO_COMPILE_TIME_PRECISION #include int main() { boost::lexical_cast(2.12345); } }}} ",Bugs,closed,Boost 1.60.0,lexical_cast,Boost 1.59.0,Problem,fixed,,rmgiroux@…