From 7a580d0a72e54b8ffe5c257323029afdbc7fab9b Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 22 Jun 2016 01:10:14 +0000 Subject: [PATCH] Don't use C++17 terse static assert. Patch from STL@microsoft.com llvm-svn: 273353 --- .../func.invoke/invoke.pass.cpp | 10 +- .../func.not_fn/not_fn.pass.cpp | 58 +++++----- .../meta/meta.rel/is_callable.pass.cpp | 102 +++++++++--------- .../meta.rel/is_nothrow_callable.pass.cpp | 40 +++---- .../is_nothrow_swappable.pass.cpp | 6 +- .../is_nothrow_swappable_with.pass.cpp | 10 +- .../meta.unary.prop/is_swappable.pass.cpp | 4 +- .../is_swappable_with.pass.cpp | 10 +- 8 files changed, 120 insertions(+), 120 deletions(-) diff --git a/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp b/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp index 89867a566e07..d1ae6b7809ce 100644 --- a/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/func.invoke/invoke.pass.cpp @@ -327,17 +327,17 @@ void noexcept_test() { { NoThrowCallable obj; ((void)obj); // suppress unused warning CopyThrows arg; ((void)arg); // suppress unused warning - static_assert(noexcept(std::invoke(obj))); - static_assert(!noexcept(std::invoke(obj, arg))); - static_assert(noexcept(std::invoke(obj, std::move(arg)))); + static_assert(noexcept(std::invoke(obj)), ""); + static_assert(!noexcept(std::invoke(obj, arg)), ""); + static_assert(noexcept(std::invoke(obj, std::move(arg))), ""); } { ThrowsCallable obj; ((void)obj); // suppress unused warning - static_assert(!noexcept(std::invoke(obj))); + static_assert(!noexcept(std::invoke(obj)), ""); } { MemberObj obj{42}; ((void)obj); // suppress unused warning. - static_assert(noexcept(std::invoke(&MemberObj::x, obj))); + static_assert(noexcept(std::invoke(&MemberObj::x, obj)), ""); } } diff --git a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp b/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp index 42ab466e41ae..948399570944 100644 --- a/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp @@ -250,10 +250,10 @@ void constructor_tests() using T = MoveOnlyCallable; T value(true); using RetT = decltype(std::not_fn(std::move(value))); - static_assert(std::is_move_constructible::value); - static_assert(!std::is_copy_constructible::value); - static_assert(!std::is_move_assignable::value); - static_assert(!std::is_copy_assignable::value); + static_assert(std::is_move_constructible::value, ""); + static_assert(!std::is_copy_constructible::value, ""); + static_assert(!std::is_move_assignable::value, ""); + static_assert(!std::is_copy_assignable::value, ""); auto ret = std::not_fn(std::move(value)); // test it was moved from assert(value.value == false); @@ -271,10 +271,10 @@ void constructor_tests() using T = CopyCallable; T value(false); using RetT = decltype(std::not_fn(value)); - static_assert(std::is_move_constructible::value); - static_assert(std::is_copy_constructible::value); - static_assert(!std::is_move_assignable::value); - static_assert(!std::is_copy_assignable::value); + static_assert(std::is_move_constructible::value, ""); + static_assert(std::is_copy_constructible::value, ""); + static_assert(!std::is_move_assignable::value, ""); + static_assert(!std::is_copy_assignable::value, ""); auto ret = std::not_fn(value); // test that value is unchanged (copied not moved) assert(value.value == false); @@ -292,10 +292,10 @@ void constructor_tests() T value(true); T value2(false); using RetT = decltype(std::not_fn(value)); - static_assert(std::is_move_constructible::value); - static_assert(std::is_copy_constructible::value); - static_assert(std::is_move_assignable::value); - static_assert(std::is_copy_assignable::value); + static_assert(std::is_move_constructible::value, ""); + static_assert(std::is_copy_constructible::value, ""); + static_assert(std::is_move_assignable::value, ""); + static_assert(std::is_copy_assignable::value, ""); auto ret = std::not_fn(value); assert(ret() == false); auto ret2 = std::not_fn(value2); @@ -309,10 +309,10 @@ void constructor_tests() T value(true); T value2(false); using RetT = decltype(std::not_fn(std::move(value))); - static_assert(std::is_move_constructible::value); - static_assert(!std::is_copy_constructible::value); - static_assert(std::is_move_assignable::value); - static_assert(!std::is_copy_assignable::value); + static_assert(std::is_move_constructible::value, ""); + static_assert(!std::is_copy_constructible::value, ""); + static_assert(std::is_move_assignable::value, ""); + static_assert(!std::is_copy_assignable::value, ""); auto ret = std::not_fn(std::move(value)); assert(ret() == false); auto ret2 = std::not_fn(std::move(value2)); @@ -328,21 +328,21 @@ void return_type_tests() { using T = CopyCallable; auto ret = std::not_fn(T{false}); - static_assert(is_same::value); - static_assert(is_same::value); + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); assert(ret() == true); } { using T = CopyCallable; auto ret = std::not_fn(T{true}); - static_assert(is_same::value); - static_assert(is_same::value); + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); assert(ret() == false); } { using T = CopyCallable; auto ret = std::not_fn(T{false}); - static_assert(is_same::value); + static_assert(is_same::value, ""); EvilBool::bang_called = 0; auto value_ret = ret(); assert(EvilBool::bang_called == 1); @@ -420,26 +420,26 @@ void throws_in_constructor_test() void call_operator_sfinae_test() { { // wrong number of arguments using T = decltype(std::not_fn(returns_true)); - static_assert(std::is_callable::value); // callable only with no args - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); // callable only with no args + static_assert(!std::is_callable::value, ""); } { // violates const correctness (member function pointer) using T = decltype(std::not_fn(&MemFunCallable::return_value_nc)); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } { // violates const correctness (call object) using Obj = CopyCallable; using NCT = decltype(std::not_fn(Obj{true})); using CT = const NCT; - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } { // returns bad type with no operator! auto fn = [](auto x) { return x; }; using T = decltype(std::not_fn(fn)); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } } diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_callable.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_callable.pass.cpp index 328b818aa600..4c85f440b0bf 100644 --- a/libcxx/test/std/utilities/meta/meta.rel/is_callable.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.rel/is_callable.pass.cpp @@ -46,24 +46,24 @@ int main() // INVOKE bullet 1, 2 and 3 { // Bullet 1 - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } { // Bullet 2 using T = std::reference_wrapper; using DT = std::reference_wrapper; using CT = std::reference_wrapper; - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } { // Bullet 3 @@ -71,36 +71,36 @@ int main() using DT = DerFromTag*; using CT = const Tag*; using ST = std::unique_ptr; - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } } { // Bullets 4, 5 and 6 using Fn = int (Tag::*); - static_assert(!std::is_callable::value); + static_assert(!std::is_callable::value, ""); { // Bullet 4 - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); } { // Bullet 5 using T = std::reference_wrapper; using DT = std::reference_wrapper; using CT = std::reference_wrapper; - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); } { // Bullet 6 @@ -108,12 +108,12 @@ int main() using DT = DerFromTag*; using CT = const Tag*; using ST = std::unique_ptr; - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); } } { @@ -121,20 +121,20 @@ int main() { // Function pointer using Fp = void(*)(Tag&, int); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } { // Function reference using Fp = void(&)(Tag&, int); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } { // Function object @@ -146,15 +146,15 @@ int main() { // Check that the conversion to the return type is properly checked using Fn = int(*)(); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(std::is_callable::value); - static_assert(!std::is_callable::value); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(std::is_callable::value, ""); + static_assert(!std::is_callable::value, ""); } { // Check for is_callable_v using Fn = void(*)(); - static_assert(std::is_callable_v); - static_assert(!std::is_callable_v); + static_assert(std::is_callable_v, ""); + static_assert(!std::is_callable_v, ""); } } diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp index 5cadc0bf8cbf..eefa6d1f22b1 100644 --- a/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.rel/is_nothrow_callable.pass.cpp @@ -58,16 +58,16 @@ void test_noexcept_function_pointers() { // Check that PMF's and function pointers *work*. is_nothrow_callable will always // return false because 'noexcept' is not part of the function type. - static_assert(throws_callable()); - static_assert(throws_callable()); + static_assert(throws_callable(), ""); + static_assert(throws_callable(), ""); } #else { // Check that PMF's and function pointers actually work and that // is_nothrow_callable returns true for noexcept PMF's and function // pointers. - static_assert(std::is_nothrow_callable::value); - static_assert(std::is_nothrow_callable::value); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(std::is_nothrow_callable::value, ""); } #endif } @@ -77,39 +77,39 @@ int main() { // Check that the conversion to the return type is properly checked using Fn = CallObject; - static_assert(std::is_nothrow_callable::value); - static_assert(std::is_nothrow_callable::value); - static_assert(std::is_nothrow_callable::value); - static_assert(throws_callable()); - static_assert(!std::is_nothrow_callable()); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(throws_callable(), ""); + static_assert(!std::is_nothrow_callable(), ""); } { // Check that the conversion to the parameters is properly checked using Fn = CallObject; - static_assert(std::is_nothrow_callable::value); - static_assert(std::is_nothrow_callable::value); - static_assert(throws_callable()); - static_assert(!std::is_nothrow_callable::value); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(throws_callable(), ""); + static_assert(!std::is_nothrow_callable::value, ""); } { // Check that the noexcept-ness of function objects is checked. using Fn = CallObject; using Fn2 = CallObject; - static_assert(std::is_nothrow_callable::value); - static_assert(throws_callable()); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(throws_callable(), ""); } { // Check that PMD derefs are noexcept using Fn = int (Tag::*); - static_assert(std::is_nothrow_callable::value); - static_assert(std::is_nothrow_callable::value); - static_assert(throws_callable()); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(std::is_nothrow_callable::value, ""); + static_assert(throws_callable(), ""); } { // Check for is_nothrow_callable_v using Fn = CallObject; - static_assert(std::is_nothrow_callable_v); - static_assert(!std::is_nothrow_callable_v); + static_assert(std::is_nothrow_callable_v, ""); + static_assert(!std::is_nothrow_callable_v, ""); } test_noexcept_function_pointers(); } diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp index f2442f71d40c..7510b4e7293c 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable.pass.cpp @@ -63,7 +63,7 @@ int main() static_assert(!std::is_nothrow_swappable::value && std::is_swappable::value, ""); static_assert(!std::is_nothrow_swappable::value - && std::is_swappable::value); + && std::is_swappable::value, ""); } { // Test that it doesn't drop the qualifiers @@ -77,7 +77,7 @@ int main() } { // test for presence of is_nothrow_swappable_v - static_assert(std::is_nothrow_swappable_v); - static_assert(!std::is_nothrow_swappable_v); + static_assert(std::is_nothrow_swappable_v, ""); + static_assert(!std::is_nothrow_swappable_v, ""); } } diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp index 54c0a0403988..e85b4279b26d 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_swappable_with.pass.cpp @@ -68,14 +68,14 @@ int main() } { // test we guard against cv void inputs as required. - static_assert(!std::is_nothrow_swappable_with_v); - static_assert(!std::is_nothrow_swappable_with_v); - static_assert(!std::is_nothrow_swappable_with_v); + static_assert(!std::is_nothrow_swappable_with_v, ""); + static_assert(!std::is_nothrow_swappable_with_v, ""); + static_assert(!std::is_nothrow_swappable_with_v, ""); } { // test for presense of is_nothrow_swappable_with_v - static_assert(std::is_nothrow_swappable_with_v); - static_assert(!std::is_nothrow_swappable_with_v); + static_assert(std::is_nothrow_swappable_with_v, ""); + static_assert(!std::is_nothrow_swappable_with_v, ""); } } diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp index 43a0a4fe46b1..b2a05d944437 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable.pass.cpp @@ -71,7 +71,7 @@ int main() } { // test for presense of is_swappable_v - static_assert(std::is_swappable_v); - static_assert(!std::is_swappable_v); + static_assert(std::is_swappable_v, ""); + static_assert(!std::is_swappable_v, ""); } } diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp index 9d470c156dc2..f557e25b72c7 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_swappable_with.pass.cpp @@ -66,13 +66,13 @@ int main() } { // test that cv void is guarded against as required. - static_assert(!std::is_swappable_with_v); - static_assert(!std::is_swappable_with_v); - static_assert(!std::is_swappable_with_v); + static_assert(!std::is_swappable_with_v, ""); + static_assert(!std::is_swappable_with_v, ""); + static_assert(!std::is_swappable_with_v, ""); } { // test for presence of is_swappable_with_v - static_assert(std::is_swappable_with_v); - static_assert(!std::is_swappable_with_v); + static_assert(std::is_swappable_with_v, ""); + static_assert(!std::is_swappable_with_v, ""); } }