From 53a420fba21cf1644972b34dcd811a43cdb8368d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 2 Jan 2017 19:18:58 +0000 Subject: Vendor import of libc++ trunk r290819: https://llvm.org/svn/llvm-project/libcxx/trunk@290819 --- .../tuple.tuple/tuple.helper/tuple_size.pass.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp') diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp index 49b4215a1956..40214f632e75 100644 --- a/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp +++ b/test/std/utilities/tuple/tuple.tuple/tuple.helper/tuple_size.pass.cpp @@ -18,19 +18,36 @@ // UNSUPPORTED: c++98, c++03 #include +#include +#include #include +template ::value)> +constexpr bool has_value(int) { return true; } +template constexpr bool has_value(long) { return false; } +template constexpr bool has_value() { return has_value(0); } + + template void test() { + static_assert(has_value(), ""); static_assert((std::is_base_of, std::tuple_size >::value), ""); + static_assert(has_value(), ""); static_assert((std::is_base_of, std::tuple_size >::value), ""); + static_assert(has_value(), ""); static_assert((std::is_base_of, std::tuple_size >::value), ""); + + static_assert(has_value(), ""); static_assert((std::is_base_of, std::tuple_size >::value), ""); + { + static_assert(!has_value(), ""); + static_assert(!has_value(), ""); + } } int main() @@ -39,4 +56,13 @@ int main() test, 1>(); test, 2>(); test, 3>(); + test, 2>(); + test, 42>(); + { + static_assert(!has_value(), ""); + static_assert(!has_value(), ""); + static_assert(!has_value(), ""); + static_assert(!has_value*>(), ""); + static_assert(!has_value&>(), ""); + } } -- cgit v1.2.3