[libcxx-commits] [libcxx] [libc++] constexpr is_sufficiently_aligned (PR #146787)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 3 08:56:51 PDT 2025


================
@@ -28,10 +27,11 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool is_sufficiently_aligned(_Tp* __ptr) {
 #  ifdef _LIBCPP_COMPILER_CLANG_BASED
   return __builtin_is_aligned(__ptr, _Alignment);
 #  else
-  if constexpr (is_constant_evaluated())
+  if consteval {
     return __builtin_constant_p(__builtin_assume_aligned(__ptr, _Alignment) != nullptr);
----------------
EricWF wrote:

I would prefer simply not supporting constexpr with GCC here.
It seems better to fail loudly than to give the wrong result. 

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


More information about the libcxx-commits mailing list