https://gcc.gnu.org/g:25ea539b3de7bb94481eb07cb7d621a3a88de727
commit r16-2191-g25ea539b3de7bb94481eb07cb7d621a3a88de727 Author: Jonathan Wakely <jwak...@redhat.com> Date: Wed Jul 2 21:16:30 2025 +0100 libstdc++: Always treat __float128 as a floating-point type Similar to the previous commit that made is_integral_v<__int128> unconditionally true, this makes is_floating_point_v<__float128> unconditionally true. With the new extended floating-point types in C++23 (std::float64_t etc.) it seems unhelpful for is_floating_point_v to be true for them, but not for __float128. Especially as it is true on some targets, because __float128 is just a typedef for long double. This change makes is_floating_point_v<__float128> true whenever the type is defined, giving less surprising and more portable behaviour. libstdc++-v3/ChangeLog: * include/bits/cpp_type_traits.h (__is_floating<__float128>): Do not depend on __STRICT_ANSI__. * include/bits/stl_algobase.h (__size_to_integer(__float128)): Likewise. * include/std/type_traits (__is_floating_point_helper<__float128>): Likewise. Reviewed-by: Patrick Palka <ppa...@redhat.com> Diff: --- libstdc++-v3/include/bits/cpp_type_traits.h | 9 +++++++++ libstdc++-v3/include/bits/stl_algobase.h | 2 +- libstdc++-v3/include/std/type_traits | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index 770ad94b3b4d..38cea4c67b76 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -313,6 +313,15 @@ __INT_N(__int128) typedef __true_type __type; }; +#ifdef _GLIBCXX_USE_FLOAT128 + template<> + struct __is_floating<__float128> + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + #ifdef __STDCPP_FLOAT16_T__ template<> struct __is_floating<_Float16> diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 71ef2335a311..b104ec2536a0 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -1065,7 +1065,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER __size_to_integer(double __n) { return (long long)__n; } inline _GLIBCXX_CONSTEXPR long long __size_to_integer(long double __n) { return (long long)__n; } -#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) +#ifdef _GLIBCXX_USE_FLOAT128 __extension__ inline _GLIBCXX_CONSTEXPR long long __size_to_integer(__float128 __n) { return (long long)__n; } #endif diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index e88d04e44d76..78a5ee8c0eb4 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -532,7 +532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public true_type { }; #endif -#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) +#ifdef _GLIBCXX_USE_FLOAT128 template<> struct __is_floating_point_helper<__float128> : public true_type { };