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

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 25 06:02:00 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)
----------------
frederick-vs-ja wrote:

> Do we want a check for `__cpp_constexpr >= 202406L` here too? `constexpr operator new` has been valid since C++23 but isn't usable without compiler support,

I'm pretty sure that `constexpr operator new` in this paper doesn't require any constexpr feature after C++11. So the library changes don't require any chang in the compiler.

> and users might check `defined(__cpp_lib_constexpr_new)` instead of `defined(__cpp_lib_constexpr_new) && __cpp_constexpr >= 202406L`

I don't think it's meaningful to check `__cpp_lib_constexpr_new`. The approach for the core pary in #104586 doesn't require library changes.

In other words, under Clang's current (WIP) approach for constexpr placement new, the core and library changes are independent.

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


More information about the libcxx-commits mailing list