diff --git a/libcxx/include/__math/traits.h b/libcxx/include/__math/traits.h index 9841e7bbc1f8a1..3d4f14fc9cd552 100644 --- a/libcxx/include/__math/traits.h +++ b/libcxx/include/__math/traits.h @@ -27,24 +27,25 @@ namespace __math { // signbit -template ::value, int> = 0> -_LIBCPP_NODISCARD inline // TODO(LLVM 22): Remove conditional once support for Clang 19 is dropped. #if defined(_LIBCPP_COMPILER_GCC) || __has_constexpr_builtin(__builtin_signbit) - _LIBCPP_CONSTEXPR_SINCE_CXX23 +# define _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_CONSTEXPR_SINCE_CXX23 +#else +# define _LIBCPP_SIGNBIT_CONSTEXPR #endif - _LIBCPP_HIDE_FROM_ABI bool - signbit(_A1 __x) _NOEXCEPT { + +template ::value, int> = 0> +_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { return __builtin_signbit(__x); } template ::value && is_signed<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { +_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { return __x < 0; } template ::value && !is_signed<_A1>::value, int> = 0> -_LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { +_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { return false; }