From be65b24a55bb50b7a1b1432413b010e02531ea31 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Wed, 26 Oct 2016 20:18:13 +0000 Subject: Cleanup nonportable behavior in tests for std::any Fixes MS issues 63, 64, and 65. test/std/utilities/any/any.class/any.cons/move.pass.cpp: * "Moves are always destructive" is not a portable assumption; check with LIBCPP_ASSERT. test/std/utilities/any/any.class/any.cons/value.pass.cpp: * The standard does not forbid initializing std::any from any pointer-to-function type. Remove the non-conforming "DecayTag" test. test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp: * Self-swap is not specified to perform no moves; check with LIBCPP_ASSERT. Differential Revision: https://reviews.llvm.org/D26007 llvm-svn: 285234 --- libcxx/test/std/utilities/any/any.class/any.cons/move.pass.cpp | 2 +- libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp | 4 ---- libcxx/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'libcxx/test/std/utilities/any') diff --git a/libcxx/test/std/utilities/any/any.class/any.cons/move.pass.cpp b/libcxx/test/std/utilities/any/any.class/any.cons/move.pass.cpp index ebd49ccdcbd..fb7dda886fe 100644 --- a/libcxx/test/std/utilities/any/any.class/any.cons/move.pass.cpp +++ b/libcxx/test/std/utilities/any/any.class/any.cons/move.pass.cpp @@ -80,8 +80,8 @@ void test_move() { assert(Type::moved == 1 || Type::moved == 2); // zero or more move operations can be performed. assert(Type::copied == 0); // no copies can be performed. assert(Type::count == 1 + a.has_value()); - assertEmpty(a); // Moves are always destructive. assertContains(a2, 42); + LIBCPP_ASSERT(!a.has_value()); // Moves are always destructive. if (a.has_value()) assertContains(a, 0); } 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 24160dcc1de..8795dfd4e36 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 @@ -136,10 +136,6 @@ void test_sfinae_constraints() { using T = std::in_place_type_t; static_assert(!std::is_constructible::value, ""); } - { - using DecayTag = std::decay_t; - static_assert(!std::is_constructible::value, ""); - } { // Test that the ValueType&& constructor SFINAE's away when the // argument is non-copyable diff --git a/libcxx/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp b/libcxx/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp index 1fef43fc585..6fc100943d0 100644 --- a/libcxx/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp +++ b/libcxx/test/std/utilities/any/any.class/any.modifiers/swap.pass.cpp @@ -104,7 +104,7 @@ void test_self_swap() { assertContains(a, 42); assert(T::count == 1); assert(T::copied == 0); - assert(T::moved == 0); + LIBCPP_ASSERT(T::moved == 0); } assert(small::count == 0); { // large @@ -113,9 +113,9 @@ void test_self_swap() { T::reset(); a.swap(a); assertContains(a, 42); - assert(T::copied == 0); - assert(T::moved == 0); assert(T::count == 1); + assert(T::copied == 0); + LIBCPP_ASSERT(T::moved == 0); } assert(large::count == 0); } -- cgit v1.2.3