Implement P0739R0: 'Some improvements to class template argument deduction integration into the standard library' This is an API change (not ABI change) due to a late change in the c++17 standard

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309296 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2017-07-27 17:44:03 +00:00
parent 24047fd4a7
commit f226a28d61
5 changed files with 18 additions and 9 deletions

View File

@@ -14,7 +14,7 @@
// template <class ...Mutex> class scoped_lock;
// scoped_lock(Mutex&..., adopt_lock_t);
// scoped_lock(adopt_lock_t, Mutex&...);
#include <mutex>
#include <cassert>
@@ -43,7 +43,7 @@ int main()
using LG = std::scoped_lock<TestMutex>;
m1.lock();
{
LG lg(m1, std::adopt_lock);
LG lg(std::adopt_lock, m1);
assert(m1.locked);
}
assert(!m1.locked);
@@ -53,7 +53,7 @@ int main()
using LG = std::scoped_lock<TestMutex, TestMutex>;
m1.lock(); m2.lock();
{
LG lg(m1, m2, std::adopt_lock);
LG lg(std::adopt_lock, m1, m2);
assert(m1.locked && m2.locked);
}
assert(!m1.locked && !m2.locked);
@@ -63,7 +63,7 @@ int main()
using LG = std::scoped_lock<TestMutex, TestMutex, TestMutex>;
m1.lock(); m2.lock(); m3.lock();
{
LG lg(m1, m2, m3, std::adopt_lock);
LG lg(std::adopt_lock, m1, m2, m3);
assert(m1.locked && m2.locked && m3.locked);
}
assert(!m1.locked && !m2.locked && !m3.locked);

View File

@@ -261,4 +261,9 @@ int main() {
test_copy_ctor_valueless_by_exception();
test_copy_ctor_sfinae();
test_constexpr_copy_ctor_extension();
{ // This is the motivating example from P0739R0
std::variant<int, double> v1(3);
std::variant v2 = v1;
(void) v2;
}
}