From 50253ed1c67b75c71c8ec2d24ed915c032b11822 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 16 Oct 2016 02:51:50 +0000 Subject: Update issue status for LWG 2744 llvm-svn: 284322 --- libcxx/test/support/any_helpers.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'libcxx/test/support') diff --git a/libcxx/test/support/any_helpers.h b/libcxx/test/support/any_helpers.h index ae332d5e0a5..a720ecd7c82 100644 --- a/libcxx/test/support/any_helpers.h +++ b/libcxx/test/support/any_helpers.h @@ -59,21 +59,30 @@ void assertEmpty(std::any const& a) { assert(any_cast(&a) == nullptr); } +template +constexpr auto has_value_member(int) -> decltype(std::declval().value, true) +{ return true; } +template constexpr bool has_value_member(long) { return false; } + + // Assert that an 'any' object stores the specified 'Type' and 'value'. template -void assertContains(std::any const& a, int value = 1) { +std::enable_if_t(0)> +assertContains(std::any const& a, int value) { assert(a.has_value()); assert(containsType(a)); assert(std::any_cast(a).value == value); } -template <> -void assertContains(std::any const& a, int value) { +template +std::enable_if_t(0)> +assertContains(std::any const& a, Value value) { assert(a.has_value()); - assert(containsType(a)); - assert(std::any_cast(a) == value); + assert(containsType(a)); + assert(std::any_cast(a) == value); } + // Modify the value of a "test type" stored within an any to the specified // 'value'. template -- cgit v1.2.3