@@ -705,15 +705,16 @@ void test_isinf()
705705 static_assert ((std::is_same<decltype (std::isinf ((float )0 )), bool >::value), " " );
706706
707707 typedef decltype (std::isinf ((double )0 )) DoubleRetType;
708- #if !defined(__linux__) || defined(__clang__)
709- static_assert ((std::is_same<DoubleRetType, bool >::value), " " );
710- #else
708+ #if defined(__GLIBC__) && defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_PREFERRED_OVERLOAD)
711709 // GLIBC < 2.23 defines 'isinf(double)' with a return type of 'int' in
712710 // all C++ dialects. The test should tolerate this when libc++ can't work
713- // around it.
711+ // around it via `_LIBCPP_PREFERRED_OVERLOAD`, which is only available
712+ // in modern versions of Clang, and not elsewhere.
714713 // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
715714 static_assert ((std::is_same<DoubleRetType, bool >::value
716715 || std::is_same<DoubleRetType, int >::value), " " );
716+ #else
717+ static_assert ((std::is_same<DoubleRetType, bool >::value), " " );
717718#endif
718719
719720 static_assert ((std::is_same<decltype (std::isinf (0 )), bool >::value), " " );
@@ -791,15 +792,16 @@ void test_isnan()
791792 static_assert ((std::is_same<decltype (std::isnan ((float )0 )), bool >::value), " " );
792793
793794 typedef decltype (std::isnan ((double )0 )) DoubleRetType;
794- #if !defined(__linux__) || defined(__clang__)
795- static_assert ((std::is_same<DoubleRetType, bool >::value), " " );
796- #else
797- // GLIBC < 2.23 defines 'isinf(double)' with a return type of 'int' in
795+ #if defined(__GLIBC__) && defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_PREFERRED_OVERLOAD)
796+ // GLIBC < 2.23 defines 'isnan(double)' with a return type of 'int' in
798797 // all C++ dialects. The test should tolerate this when libc++ can't work
799- // around it.
798+ // around it via `_LIBCPP_PREFERRED_OVERLOAD`, which is only available
799+ // in modern versions of Clang, and not elsewhere.
800800 // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
801801 static_assert ((std::is_same<DoubleRetType, bool >::value
802802 || std::is_same<DoubleRetType, int >::value), " " );
803+ #else
804+ static_assert ((std::is_same<DoubleRetType, bool >::value), " " );
803805#endif
804806
805807 static_assert ((std::is_same<decltype (std::isnan (0 )), bool >::value), " " );
0 commit comments