[libcxx-commits] [libcxx] [libc++][ABI BREAK] Make std::pair trivially copyable if its members are (PR #89652)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 25 09:24:58 PDT 2024
================
@@ -141,6 +142,31 @@ struct _LIBCPP_TEMPLATE_VIS pair
_NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value&& is_nothrow_copy_constructible<second_type>::value)
: first(__t1), second(__t2) {}
+ // Make pair trivially copyable if we have a way to do it
----------------
ldionne wrote:
With the patch as-is, we have the following matrix:
```
clang 03 | non trivial
clang 11 | trivial (__enable_if__)
clang 14 | trivial (__enable_if__)
clang 17 | trivial (__enable_if__)
clang 20 | trivial (requires)
clang 23 | trivial (requires)
clang 26 | trivial (requires)
gcc 03 | not supported
gcc 11 | non trivial
gcc 14 | non trivial
gcc 17 | non trivial
gcc 20 | trivial (requires)
gcc 23 | trivial (requires)
gcc 26 | trivial (requires)
```
We'd need to make Clang in C++03 mode agree with Clang in other standard versions. I think we'll also need to have a project discussion about what the intent is regarding Clang and GCC ABI compatibility for the standard library, since this appears to be both difficult to achieve and not achieved right now. And the value of it is something I could imagine being debated.
So basically my request would be to use `__enable_if__` in the C++03 branch of pair. And this needs to be tested.
https://github.com/llvm/llvm-project/pull/89652
More information about the libcxx-commits
mailing list