diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc index f1519e5c7b6..26b69a38521 100644 --- a/libstdc++-v3/src/c++17/floating_from_chars.cc +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc @@ -300,12 +300,16 @@ namespace errno = 0; char* endptr; T tmpval; +#if _GLIBCXX_USE_C99_STDLIB if constexpr (is_same_v) tmpval = std::strtof(str, &endptr); - if constexpr (is_same_v) + else if constexpr (is_same_v) tmpval = std::strtod(str, &endptr); else if constexpr (is_same_v) tmpval = std::strtold(str, &endptr); +#else + tmpval = std::strtod(str, &endptr); +#endif const int conv_errno = std::__exchange(errno, save_errno); #if _GLIBCXX_USE_C99_FENV_TR1 @@ -319,7 +323,7 @@ namespace const ptrdiff_t n = endptr - str; if (conv_errno == ERANGE) [[unlikely]] { - if (std::isinf(tmpval)) // overflow + if (isinf(tmpval)) // overflow ec = errc::result_out_of_range; else // underflow (LWG 3081 wants to set value = tmpval here) ec = errc::result_out_of_range;