[libcxx-commits] [libcxx] [libc++][C++26] P2562R1: `constexpr` Stable Sorting (PR #110320)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 10 07:53:23 PST 2024


================
@@ -35,6 +36,15 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+// Making placement new available in constexpr contexts. This is necessary to work around a "constexpr placement new"
+// bug in gcc (fixed in 14.2). See https://github.com/llvm/llvm-project/pull/110320#discussion_r1788557715.
+#if _LIBCPP_STD_VER >= 20
+#  define _LIBCPP_MOVING_PLACEMENT_NEW(__ptr, __type, __move_func, __iter) std::construct_at(__ptr, __move_func(__iter))
+#else
+#  define _LIBCPP_MOVING_PLACEMENT_NEW(__ptr, __type, __move_func, __iter)                                             \
+    ::new ((void*)__ptr) __type(__move_func(__iter))
+#endif
----------------
ldionne wrote:

Let's just use `std::__construct_at` unconditionally.

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


More information about the libcxx-commits mailing list