[libcxx-commits] [libcxx] [libc++][math] Add `constexpr` for `std::signbit()` (PR #105946)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 30 12:52:07 PDT 2024


================
@@ -28,17 +28,23 @@ namespace __math {
 // signbit
 
 template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
-_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT {
+_LIBCPP_NODISCARD inline
+// TODO(LLVM 22): Remove conditional once support for Clang 19 is dropped.
+#if !defined(__clang__) || __has_constexpr_builtin(__builtin_signbit)
----------------
philnik777 wrote:

```suggestion
#if defined(_LIBCPP_COMPILER_GCC) || __has_constexpr_builtin(__builtin_signbit)
```
I think that's what you really mean.

https://github.com/llvm/llvm-project/pull/105946


More information about the libcxx-commits mailing list