boostorg / lexical_cast

General literal text conversions, such as an int represented as a string, or vice versa
https://boost.org/libs/lexical_cast
34 stars 58 forks source link

Remove the workaround for llvm.15723? #52

Closed Chandlerooo closed 2 years ago

Chandlerooo commented 2 years ago

I find a workaround for llvm.15723 in lexical_cast_test.cpp:https://github.com/boostorg/lexical_cast/blob/a9f296115967335aaa9f4a4cadfd900f131a60d1/test/lexical_cast_test.cpp

#ifndef _LIBCPP_VERSION
    // libc++ had a bug in implementation of stream conversions for values that must be represented as infinity.
    // http://llvm.org/bugs/show_bug.cgi?id=15723#c4
    BOOST_CHECK_THROW(lexical_cast<test_t>(s_max_value+"1"), bad_lexical_cast);
    BOOST_CHECK_THROW(lexical_cast<test_t>(s_max_value+"9"), bad_lexical_cast);

    // VC9 can fail the following tests on floats and doubles when using stingstream...
    BOOST_CHECK_THROW(lexical_cast<test_t>("1"+s_max_value), bad_lexical_cast);
    BOOST_CHECK_THROW(lexical_cast<test_t>("9"+s_max_value), bad_lexical_cast);
#endif

This compiler bug is marked as fixed: http://llvm.org/bugs/show_bug.cgi?id=15723 Shall the workaround be removed?

apolukhin commented 2 years ago

It could be disabled for new versions of libc++. PR would be welcomed:)

apolukhin commented 2 years ago

Feel free to create a PR if you wish. Closing this issue