[all-commits] [llvm/llvm-project] 02af67: [libc++] Fix triviality of std::pair for trivially...
Louis Dionne via All-commits
all-commits at lists.llvm.org
Wed Jun 19 11:52:41 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 02af67c88f393cd6998949cc1bf8075553579a42
https://github.com/llvm/llvm-project/commit/02af67c88f393cd6998949cc1bf8075553579a42
Author: Louis Dionne <ldionne.2 at gmail.com>
Date: 2024-06-19 (Wed, 19 Jun 2024)
Changed paths:
M libcxx/include/__utility/pair.h
A libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
A libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
A libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp
R libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp
R libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp
M libcxx/utils/libcxx/test/dsl.py
M libcxx/utils/libcxx/test/features.py
Log Message:
-----------
[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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list