[libcxx-commits] [libcxx] [libc++] P2747R2: `constexpr` placement new (library part) (PR #105768)

Mital Ashok via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 25 08:57:34 PDT 2024


================
@@ -510,7 +510,9 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # undef  __cpp_lib_bind_front
 # define __cpp_lib_bind_front                           202306L
 # define __cpp_lib_bitset                               202306L
-// # define __cpp_lib_constexpr_new                        202406L
+# if !defined(_LIBCPP_ABI_VCRUNTIME)
----------------
MitalAshok wrote:

Your right, I was thinking that `operator new` could never be called in a constant expression, which might have been ill-formed NDR before C++23, but I forgot it could just be called directly `operator new(1zu, p)` without a new-expression. Which I guess is the only thing this patch adds support for with clang.

Looks like the GCC implementation *does* check if `operator new` is marked `constexpr`: https://godbolt.org/z/hYaYYvaKc so this is needed for GCC at least.

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


More information about the libcxx-commits mailing list