diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-10-07 21:27:45 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-10-07 21:27:45 +0000 |
commit | b18fd9654f67876d366dc7d5577a5c91287d8353 (patch) | |
tree | 19539be19870ba70f2fe9c75d55ef4aaa9e28f4d /libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp | |
parent | c50b1a263bcb7edd1d6f2e08cb47a6dcc0562eb7 (diff) | |
download | bcm5719-llvm-b18fd9654f67876d366dc7d5577a5c91287d8353.tar.gz bcm5719-llvm-b18fd9654f67876d366dc7d5577a5c91287d8353.zip |
Fix various issues in std::any and the related tests.
* Fix self-swap. Patch from Casey Carter.
* Remove workarounds and tests for types with deleted move constructors. This
was originally added as part of a LWG proposed resolution that has since
changed.
* Re-apply most recent PR for LWG 2769.
* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
use the decayed type.
* Fix tests to allow moved-from std::any's to have a non-empty state. This is
the behavior of MSVC's std::any.
* Various whitespace and test fixes.
llvm-svn: 283606
Diffstat (limited to 'libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp')
-rw-r--r-- | libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp b/libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp index ba5419b1245..e39f139dadc 100644 --- a/libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp +++ b/libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp @@ -30,7 +30,6 @@ using std::any; using std::any_cast; - template <class Type> void test_copy_value_throws() { @@ -107,33 +106,6 @@ void test_copy_move_value() { } } -void test_non_moveable_type() -{ - using Type = deleted_move; - { - deleted_move mv(42); - std::any a(mv); - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::moved == 0); - assertContains<Type>(a, 42); - } - assert(Type::count == 0); - Type::reset(); - { - deleted_move mv(42); - std::any a(std::move(mv)); - assert(Type::count == 2); - assert(Type::copied == 1); - assert(Type::moved == 0); - assertContains<Type>(a, 42); - } - assert(Type::count == 0); - Type::reset(); -} - - - // Test that any(ValueType&&) is *never* selected for a std::in_place type. void test_sfinae_constraints() { using Tag = std::in_place_type_t<int>; @@ -169,6 +141,7 @@ void test_sfinae_constraints() { NoCopy(int) {} }; static_assert(!std::is_constructible<std::any, NoCopy>::value, ""); + static_assert(!std::is_constructible<std::any, NoCopy&>::value, ""); static_assert(!std::is_convertible<NoCopy, std::any>::value, ""); } } @@ -179,6 +152,5 @@ int main() { test_copy_value_throws<small_throws_on_copy>(); test_copy_value_throws<large_throws_on_copy>(); test_move_value_throws(); - test_non_moveable_type(); test_sfinae_constraints(); }
\ No newline at end of file |