summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-10-07 21:27:45 +0000
committerEric Fiselier <eric@efcs.ca>2016-10-07 21:27:45 +0000
commitb18fd9654f67876d366dc7d5577a5c91287d8353 (patch)
tree19539be19870ba70f2fe9c75d55ef4aaa9e28f4d /libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp
parentc50b1a263bcb7edd1d6f2e08cb47a6dcc0562eb7 (diff)
downloadbcm5719-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.assign/value.pass.cpp')
-rw-r--r--libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp b/libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp
index d844fcfaa7c..cb8dd4ca964 100644
--- a/libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp
+++ b/libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp
@@ -11,7 +11,8 @@
// <any>
-// any& operator=(any const &);
+// template <class ValueType>
+// any& operator=(ValueType&&);
// Test value copy and move assignment.
@@ -65,10 +66,12 @@ void test_assign_value() {
assert(RHS::moved >= 1);
assert(RHS::copied == 0);
assert(LHS::count == 0);
- assert(RHS::count == 1);
+ assert(RHS::count == 1 + rhs.has_value());
+ LIBCPP_ASSERT(!rhs.has_value());
assertContains<RHS>(lhs, 2);
- assertEmpty<RHS>(rhs);
+ if (rhs.has_value())
+ assertContains<RHS>(rhs, 0);
}
assert(LHS::count == 0);
assert(RHS::count == 0);
@@ -114,7 +117,7 @@ void test_assign_value_empty() {
template <class Tp, bool Move = false>
void test_assign_throws() {
#if !defined(TEST_HAS_NO_EXCEPTIONS)
- auto try_throw=
+ auto try_throw =
[](any& lhs, auto&& rhs) {
try {
Move ? lhs = std::move(rhs)
@@ -188,6 +191,7 @@ void test_sfinae_constraints() {
NoCopy(NoCopy&&) = default;
};
static_assert(!std::is_assignable<std::any, NoCopy>::value, "");
+ static_assert(!std::is_assignable<std::any, NoCopy&>::value, "");
}
}
@@ -202,4 +206,4 @@ int main() {
test_assign_throws<large_throws_on_copy>();
test_assign_throws<throws_on_move, /* Move = */ true>();
test_sfinae_constraints();
-} \ No newline at end of file
+}
OpenPOWER on IntegriCloud