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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 9 06:48:01 PDT 2024


================
@@ -74,6 +75,31 @@ struct _LIBCPP_TEMPLATE_VIS pair
   _LIBCPP_HIDE_FROM_ABI pair(pair const&) = default;
   _LIBCPP_HIDE_FROM_ABI pair(pair&&)      = default;
 
+  // Make pair trivially copyable if we have a way to do it
----------------
ldionne wrote:

This comment is somewhat misleading since we make it trivially copyable if we have a way to do it *and* were asked to do it in the ABI configuration. We could instead say

```
// 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.
```

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


More information about the libcxx-commits mailing list