diff options
Diffstat (limited to 'libcxx/test/std/utilities/any/any.class')
-rw-r--r-- | libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp index 75dfb0a2e70..7ed6121e530 100644 --- a/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp +++ b/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp @@ -44,7 +44,7 @@ void test_emplace_type() { auto &v = a.emplace<Type>(); static_assert( std::is_same_v<Type&, decltype(v)>, "" ); - assert(&v == std::any_cast<Type>(&a)); + assert(&v == std::any_cast<Type>(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -60,7 +60,7 @@ void test_emplace_type() { auto &v = a.emplace<Type>(101); static_assert( std::is_same_v<Type&, decltype(v)>, "" ); - assert(&v == std::any_cast<Type>(&a)); + assert(&v == std::any_cast<Type>(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -76,7 +76,7 @@ void test_emplace_type() { auto &v = a.emplace<Type>(-1, 42, -1); static_assert( std::is_same_v<Type&, decltype(v)>, "" ); - assert(&v == std::any_cast<Type>(&a)); + assert(&v == std::any_cast<Type>(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -97,7 +97,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace<Type>(); static_assert( std::is_same_v<Type&, decltype(v)>, "" ); - assert(&v == std::any_cast<Type>(&a)); + assert(&v == std::any_cast<Type>(&a)); assert(Tracked::count == 0); assertArgsMatch<Type>(a); @@ -107,7 +107,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace<Type>(-1, 42, -1); static_assert( std::is_same_v<Type&, decltype(v)>, "" ); - assert(&v == std::any_cast<Type>(&a)); + assert(&v == std::any_cast<Type>(&a)); assert(Tracked::count == 0); assertArgsMatch<Type, int, int, int>(a); @@ -118,7 +118,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace<Type>({-1, 42, -1}); static_assert( std::is_same_v<Type&, decltype(v)>, "" ); - assert(&v == std::any_cast<Type>(&a)); + assert(&v == std::any_cast<Type>(&a)); assert(Tracked::count == 0); assertArgsMatch<Type, std::initializer_list<int>>(a); @@ -129,7 +129,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace<Type>({-1, 42, -1}, x); static_assert( std::is_same_v<Type&, decltype(v)>, "" ); - assert(&v == std::any_cast<Type>(&a)); + assert(&v == std::any_cast<Type>(&a)); assert(Tracked::count == 0); assertArgsMatch<Type, std::initializer_list<int>, int&>(a); @@ -159,7 +159,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace<Type>(101); + auto &v = a.emplace<Type>(101); + static_assert( std::is_same_v<Type&, decltype(v)>, "" ); assert(false); } catch (int const&) { } @@ -169,7 +170,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace<Type>({1, 2, 3}, 101); + auto &v = a.emplace<Type>({1, 2, 3}, 101); + static_assert( std::is_same_v<Type&, decltype(v)>, "" ); assert(false); } catch (int const&) { } @@ -180,7 +182,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace<Type>(101); + auto &v = a.emplace<Type>(101); + static_assert( std::is_same_v<Type&, decltype(v)>, "" ); assert(false); } catch (int const&) { } @@ -190,7 +193,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace<Type>({1, 2, 3}, 101); + auto &v = a.emplace<Type>({1, 2, 3}, 101); + static_assert( std::is_same_v<Type&, decltype(v)>, "" ); assert(false); } catch (int const&) { } |