Implement LWG 2904.
Summary: - Removed the move-constructibe requirement from copy-assignable. - Updated `__assign_alt` such that we direct initialize if `_Tp` can be `nothrow`-constructible from `_Arg`, or `_Tp`'s move construction can throw. Otherwise, construct a temporary and move it. - Updated the tests to remove the pre-LWG2904 path. Depends on D32671. Reviewers: EricWF, CaseyCarter Reviewed By: EricWF Differential Revision: https://reviews.llvm.org/D33965 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304891 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -183,13 +183,7 @@ void test_move_assignment_sfinae() {
|
||||
}
|
||||
{
|
||||
using V = std::variant<int, CopyOnly>;
|
||||
#ifdef _LIBCPP_VERSION // LWG2904
|
||||
// variant only provides move assignment when both the move constructor
|
||||
// and move assignment operator are well formed.
|
||||
static_assert(!std::is_move_assignable<V>::value, "");
|
||||
#else // _LIBCPP_VERSION // LWG2904
|
||||
static_assert(std::is_move_assignable<V>::value, "");
|
||||
#endif // _LIBCPP_VERSION // LWG2904
|
||||
}
|
||||
{
|
||||
using V = std::variant<int, NoCopy>;
|
||||
@@ -232,12 +226,10 @@ void test_move_assignment_sfinae() {
|
||||
using V = std::variant<int, TrivialCopyNontrivialMove>;
|
||||
static_assert(!std::is_trivially_move_assignable<V>::value, "");
|
||||
}
|
||||
#ifndef _LIBCPP_VERSION // LWG2904
|
||||
{
|
||||
using V = std::variant<int, CopyOnly>;
|
||||
static_assert(std::is_trivially_move_assignable<V>::value, "");
|
||||
}
|
||||
#endif // _LIBCPP_VERSION // LWG2904
|
||||
}
|
||||
|
||||
void test_move_assignment_empty_empty() {
|
||||
|
||||
Reference in New Issue
Block a user