[libcxx-commits] [libcxx] [libc++] Make std::pair trivially copyable if its members are (PR #89652)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 2 14:15:18 PDT 2024


================
@@ -74,6 +75,30 @@ struct _LIBCPP_TEMPLATE_VIS pair
   _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
   _LIBCPP_HIDE_FROM_ABI pair(pair&&)      = default;
 
+  // When we are requested for pair to be trivially copyable by the ABI macro, we use defaulted members
+  // if it is both legal to do it (i.e. no references) and we have a way to actually implement it, which requires
+  // the __enable_if__ attribute before C++20.
+#if defined(_LIBCPP_ABI_TRIVIALLY_COPYABLE_PAIR) && _LIBCPP_STD_VER >= 20
----------------
EricWF wrote:

I worry about shipping this since the ABI is not stable across compilers (GCC before C++20 produces a different ABI).



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


More information about the libcxx-commits mailing list