diff options
author | Louis Dionne <ldionne.2@gmail.com> | 2024-06-19 14:52:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-19 14:52:20 -0400 |
commit | 02af67c88f393cd6998949cc1bf8075553579a42 (patch) | |
tree | ba35add49bee35301adfde83d445cf9b1a8e0ee3 /libcxx/utils | |
parent | eb8d036565496d4466ad9974fdf8ff91812feefb (diff) | |
download | llvm-02af67c88f393cd6998949cc1bf8075553579a42.zip llvm-02af67c88f393cd6998949cc1bf8075553579a42.tar.gz llvm-02af67c88f393cd6998949cc1bf8075553579a42.tar.bz2 |
[libc++] Fix triviality of std::pair for trivially copyable types without an assignment operator (#95444)
Since 83ead2b, std::pair would not be trivially copyable when it holds a
trivially copyable type without an assignment operator. That is because
pair gained an elligible copy-assignment-operator (the const version) in
83ead2b in C++ >= 23.
This means that the trivially copyable property of std::pair for such
types would be inconsistent between C++11/14/17/20 (trivially copyable)
and C++23/26 (not trivially copyable). This patch makes std::pair's
behavior consistent in all Standard modes EXCEPT C++03, which is a
pre-existing condition and we have no way of changing (also, it
shouldn't matter because the std::is_trivially_copyable trait was
introduced in C++11).
While this is not technically an ABI break, in practice we do know that
folks sometimes use a different representation based on whether a type
is trivially copyable. So we're treating 83ead2b as an ABI break and
this patch is fixing said breakage.
This patch also adds tests stolen from #89652 that pin down the ABI of
std::pair with respect to being trivially copyable.
Fixes #95428
Diffstat (limited to 'libcxx/utils')
-rw-r--r-- | libcxx/utils/libcxx/test/dsl.py | 4 | ||||
-rw-r--r-- | libcxx/utils/libcxx/test/features.py | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py index 7ac66d4..624a00d 100644 --- a/libcxx/utils/libcxx/test/dsl.py +++ b/libcxx/utils/libcxx/test/dsl.py @@ -308,8 +308,8 @@ def compilerMacros(config, flags=""): with open(test.getSourcePath(), "w") as sourceFile: sourceFile.write( """ - #if __has_include(<__config_site>) - # include <__config_site> + #if __has_include(<__config>) + # include <__config> #endif """ ) diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py index 7a9631a..28c9c35 100644 --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -335,10 +335,10 @@ DEFAULT_FEATURES = [ ] # Deduce and add the test features that that are implied by the #defines in -# the <__config_site> header. +# the <__config> header. # # For each macro of the form `_LIBCPP_XXX_YYY_ZZZ` defined below that -# is defined after including <__config_site>, add a Lit feature called +# is defined after including <__config>, add a Lit feature called # `libcpp-xxx-yyy-zzz`. When a macro is defined to a specific value # (e.g. `_LIBCPP_ABI_VERSION=2`), the feature is `libcpp-xxx-yyy-zzz=<value>`. # @@ -352,6 +352,7 @@ macros = { "_LIBCPP_NO_VCRUNTIME": "libcpp-no-vcruntime", "_LIBCPP_ABI_VERSION": "libcpp-abi-version", "_LIBCPP_ABI_BOUNDED_ITERATORS": "libcpp-has-abi-bounded-iterators", + "_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR": "libcpp-deprecated-abi-disable-pair-trivial-copy-ctor", "_LIBCPP_HAS_NO_FILESYSTEM": "no-filesystem", "_LIBCPP_HAS_NO_RANDOM_DEVICE": "no-random-device", "_LIBCPP_HAS_NO_LOCALIZATION": "no-localization", |