id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 13366,lexical_cast throws std::bad_cast,amitkumar.sachan@…,Antony Polukhin,"lexical_cast always throws std::bad_cast exception while converting values of type std::basic_string (where ci_char_traits is derived from std::char_traits) to double on Linux. It works on windows though(i.e. throws boost::bad_lexcial_cast exception for bad values, and returns double for valid values). It also works on Linux with boost 1.57. I noticed there has been a change in lexical_cast implementation that causes this issue now. std::bad_cast exception is thrown here because locale associated with the stream does not has std::num_get > > facet as shown in the stack trace below. It works with std::string (std::basic_string) > ) because locale has std::num_get> > facet. #0 __cxxabiv1::__cxa_throw (obj=0x60b0c0, tinfo=0x60a3f0 <_ZTISt8bad_cast@@GLIBCXX_3.4>, dest=0x2aaaaab092e0 ) at ../../../../gcc-4.8.1/libstdc++-v3/libsupc++/eh_throw.cc:71 #1 0x00002aaaaab5fb62 in std::__throw_bad_cast () at ../../../../../gcc-4.8.1/libstdc++-v3/src/c++11/functexcept.cc:56 #2 0x00000000004051bc in std::__check_facet > > (__f=0x0) at /xxxx/xxxx/xxxx/gcc-4.8.1/include/c++/4.8.1/bits/basic_ios.h:49 #3 0x0000000000404b3f in std::basic_istream::_M_extract (this=0x7fffffffe000, __v=@0x7fffffffe228: 0) at /xxxx/xxxx/xxxx/gcc-4.8.1/include/c++/4.8.1/bits/istream.tcc:95 #4 0x0000000000404397 in std::basic_istream::operator>> (this=0x7fffffffe000, __f=@0x7fffffffe228: 0) at /xxxx/xxxx/xxxx/gcc-4.8.1/include/c++/4.8.1/istream:219 #5 0x0000000000403b84 in boost::detail::lexical_ostream_limited_src::shr_using_base_class (this=0x7fffffffe1a0, output=@0x7fffffffe228: 0) at /xxxx/xxxx/xxxx/include/boost/lexical_cast/detail/converter_lexical_streams.hpp:600 #6 0x0000000000403503 in boost::detail::lexical_ostream_limited_src::float_types_converter_internal (this=0x7fffffffe1a0, output=@0x7fffffffe228: 0) at /xxxx/xxxx/xxxx/include/boost/lexical_cast/detail/converter_lexical_streams.hpp:744 #7 0x0000000000403145 in boost::detail::lexical_ostream_limited_src::operator>> ( this=0x7fffffffe1a0, output=@0x7fffffffe228: 0) at /xxxx/xxxx/xxxx/include/boost/lexical_cast/detail/converter_lexical_streams.hpp:770 #8 0x0000000000402cce in boost::detail::lexical_converter_impl > >::try_convert (arg=..., result=@0x7fffffffe228: 0) at /xxxx/xxxx/xxxx/include/boost/lexical_cast/detail/converter_lexical.hpp:485 #9 0x0000000000402a32 in boost::conversion::detail::try_lexical_convert > > (arg=..., result=@0x7fffffffe228: 0) at /xxxx/xxxx/xxxx/include/boost/lexical_cast/try_lexical_convert.hpp:196 #10 0x00000000004027be in boost::lexical_cast > > (arg=...) at /xxxx/xxxx/xxxx/include/boost/lexical_cast.hpp:41 #11 0x0000000000401d7f in lexicalcast (mystr=...) at lexicalcast_test.cpp:14 #12 0x0000000000401f0d in main () at lexicalcast_test.cpp:39 ",Bugs,closed,To Be Determined,lexical_cast,Boost 1.64.0,Regression,duplicate,,