[libcxx-commits] [libcxx] [libc++][C++26] P2562R1: `constexpr` Stable Sorting (PR #110320)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Nov 9 04:32:15 PST 2024
================
@@ -34,6 +34,16 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
+// Workaround for "constexpr placement new" bug in gcc (fixed in 14.2).
+// See https://github.com/llvm/llvm-project/pull/110320#discussion_r1788557715.
+#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 <= 140100)
+# define _LIBCPP_MOVING_PLACEMENT_NEW(__ptr, __type, __move_func, __iter) \
+ [__ptr, &__iter] { ::new ((void*)__ptr) __type(__move_func(__iter)); }()
+#else
+# define _LIBCPP_MOVING_PLACEMENT_NEW(__ptr, __type, __move_func, __iter) \
+ ::new ((void*)__ptr) __type(__move_func(__iter))
+#endif
----------------
PaulXiCao wrote:
I replaced it by `construct_at` for C++20. Let me know how you feel about it.
https://github.com/llvm/llvm-project/pull/110320
More information about the libcxx-commits
mailing list