constexpr _Float16
nextafter(_Float16 __x, _Float16 __y)
{
- if (std::__is_constant_evaluated())
- return __builtin_nextafterf16(__x, __y);
+#if __cpp_if_consteval >= 202106L
+ // Can't use if (std::__is_constant_evaluated()) here, as it
+ // doesn't guarantee optimizing the body away at -O0 and
+ // nothing defines nextafterf16.
+ if consteval { return __builtin_nextafterf16(__x, __y); }
+#endif
#ifdef __INT16_TYPE__
using __float16_int_type = __INT16_TYPE__;
#else
constexpr __gnu_cxx::__bfloat16_t
nextafter(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
{
- if (std::__is_constant_evaluated())
- return __builtin_nextafterf16b(__x, __y);
+#if __cpp_if_consteval >= 202106L
+ // Can't use if (std::__is_constant_evaluated()) here, as it
+ // doesn't guarantee optimizing the body away at -O0 and
+ // nothing defines nextafterf16b.
+ if consteval { return __builtin_nextafterf16b(__x, __y); }
+#endif
#ifdef __INT16_TYPE__
using __bfloat16_int_type = __INT16_TYPE__;
#else