From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../meta/meta.hel/integral_constant.pass.cpp | 47 +++++ .../utilities/meta/meta.rel/is_base_of.pass.cpp | 49 ++++++ .../meta/meta.rel/is_convertible.pass.cpp | 189 ++++++++++++++++++++ .../std/utilities/meta/meta.rel/is_same.pass.cpp | 59 +++++++ .../meta/meta.rqmts/nothing_to_do.pass.cpp | 12 ++ .../meta.trans.arr/remove_all_extents.pass.cpp | 41 +++++ .../meta.trans.arr/remove_extent.pass.cpp | 42 +++++ .../meta.trans/meta.trans.cv/add_const.pass.cpp | 43 +++++ .../meta/meta.trans/meta.trans.cv/add_cv.pass.cpp | 43 +++++ .../meta.trans/meta.trans.cv/add_volatile.pass.cpp | 43 +++++ .../meta.trans/meta.trans.cv/remove_const.pass.cpp | 43 +++++ .../meta.trans/meta.trans.cv/remove_cv.pass.cpp | 43 +++++ .../meta.trans.cv/remove_volatile.pass.cpp | 43 +++++ .../meta.trans.other/aligned_storage.pass.cpp | 194 +++++++++++++++++++++ .../meta.trans.other/aligned_union.pass.cpp | 92 ++++++++++ .../meta.trans.other/common_type.pass.cpp | 52 ++++++ .../meta.trans.other/conditional.pass.cpp | 24 +++ .../meta.trans/meta.trans.other/decay.pass.cpp | 34 ++++ .../meta.trans/meta.trans.other/enable_if.fail.cpp | 19 ++ .../meta.trans/meta.trans.other/enable_if.pass.cpp | 24 +++ .../meta.trans.other/enable_if2.fail.cpp | 23 +++ .../meta.trans/meta.trans.other/result_of.pass.cpp | 98 +++++++++++ .../meta.trans.other/underlying_type.pass.cpp | 41 +++++ .../meta.trans/meta.trans.ptr/add_pointer.pass.cpp | 34 ++++ .../meta.trans.ptr/remove_pointer.pass.cpp | 43 +++++ .../meta.trans.ref/add_lvalue_ref.pass.cpp | 34 ++++ .../meta.trans.ref/add_rvalue_ref.pass.cpp | 40 +++++ .../meta.trans/meta.trans.ref/remove_ref.pass.cpp | 46 +++++ .../meta.trans.sign/make_signed.pass.cpp | 64 +++++++ .../meta.trans.sign/make_unsigned.pass.cpp | 65 +++++++ .../meta/meta.trans/nothing_to_do.pass.cpp | 12 ++ .../meta/meta.type.synop/nothing_to_do.pass.cpp | 12 ++ .../meta.unary.prop.query/alignment_of.pass.cpp | 47 +++++ .../meta/meta.unary.prop.query/extent.pass.cpp | 60 +++++++ .../meta/meta.unary.prop.query/rank.pass.cpp | 46 +++++ .../meta/meta.unary.prop.query/void_t.pass.cpp | 69 ++++++++ .../meta/meta.unary/meta.unary.cat/array.pass.cpp | 55 ++++++ .../meta/meta.unary/meta.unary.cat/class.pass.cpp | 55 ++++++ .../meta/meta.unary/meta.unary.cat/enum.pass.cpp | 51 ++++++ .../meta.unary.cat/floating_point.pass.cpp | 51 ++++++ .../meta.unary/meta.unary.cat/function.pass.cpp | 52 ++++++ .../meta.unary/meta.unary.cat/integral.pass.cpp | 65 +++++++ .../meta.unary/meta.unary.cat/lvalue_ref.pass.cpp | 41 +++++ .../member_function_pointer.pass.cpp | 102 +++++++++++ .../member_function_pointer_no_variadics.pass.cpp | 76 ++++++++ .../meta.unary.cat/member_object_pointer.pass.cpp | 53 ++++++ .../meta.unary/meta.unary.cat/nullptr.pass.cpp | 52 ++++++ .../meta.unary/meta.unary.cat/pointer.pass.cpp | 52 ++++++ .../meta.unary/meta.unary.cat/rvalue_ref.pass.cpp | 43 +++++ .../meta/meta.unary/meta.unary.cat/union.pass.cpp | 55 ++++++ .../meta/meta.unary/meta.unary.cat/void.pass.cpp | 49 ++++++ .../meta/meta.unary/meta.unary.comp/array.pass.cpp | 46 +++++ .../meta/meta.unary/meta.unary.comp/class.pass.cpp | 46 +++++ .../meta/meta.unary/meta.unary.comp/enum.pass.cpp | 42 +++++ .../meta.unary.comp/floating_point.pass.cpp | 42 +++++ .../meta.unary/meta.unary.comp/function.pass.cpp | 43 +++++ .../meta.unary/meta.unary.comp/integral.pass.cpp | 56 ++++++ .../meta.unary/meta.unary.comp/lvalue_ref.pass.cpp | 32 ++++ .../member_function_pointer.pass.cpp | 46 +++++ .../meta.unary.comp/member_object_pointer.pass.cpp | 44 +++++ .../meta.unary/meta.unary.comp/pointer.pass.cpp | 43 +++++ .../meta.unary/meta.unary.comp/rvalue_ref.pass.cpp | 34 ++++ .../meta/meta.unary/meta.unary.comp/union.pass.cpp | 46 +++++ .../meta/meta.unary/meta.unary.comp/void.pass.cpp | 40 +++++ .../__has_operator_addressof.pass.cpp | 71 ++++++++ .../has_virtual_destructor.pass.cpp | 77 ++++++++ .../meta.unary.prop/is_abstract.pass.cpp | 71 ++++++++ .../meta.unary.prop/is_assignable.pass.cpp | 70 ++++++++ .../meta.unary/meta.unary.prop/is_const.pass.cpp | 37 ++++ .../meta.unary.prop/is_constructible.pass.cpp | 86 +++++++++ .../meta.unary.prop/is_copy_assignable.pass.cpp | 80 +++++++++ .../meta.unary.prop/is_copy_constructible.pass.cpp | 88 ++++++++++ .../is_default_constructible.pass.cpp | 93 ++++++++++ .../meta.unary.prop/is_destructible.pass.cpp | 121 +++++++++++++ .../meta.unary/meta.unary.prop/is_empty.pass.cpp | 65 +++++++ .../meta.unary/meta.unary.prop/is_final.pass.cpp | 53 ++++++ .../meta.unary.prop/is_literal_type.pass.cpp | 46 +++++ .../meta.unary.prop/is_move_assignable.pass.cpp | 65 +++++++ .../meta.unary.prop/is_move_constructible.pass.cpp | 81 +++++++++ .../meta.unary.prop/is_nothrow_assignable.pass.cpp | 55 ++++++ .../is_nothrow_constructible.pass.cpp | 103 +++++++++++ .../is_nothrow_copy_assignable.pass.cpp | 65 +++++++ .../is_nothrow_copy_constructible.pass.cpp | 61 +++++++ .../is_nothrow_default_constructible.pass.cpp | 64 +++++++ .../is_nothrow_destructible.pass.cpp | 91 ++++++++++ .../is_nothrow_move_assignable.pass.cpp | 63 +++++++ .../is_nothrow_move_constructible.pass.cpp | 61 +++++++ .../meta.unary/meta.unary.prop/is_pod.pass.cpp | 52 ++++++ .../meta.unary.prop/is_polymorphic.pass.cpp | 82 +++++++++ .../meta.unary/meta.unary.prop/is_signed.pass.cpp | 59 +++++++ .../meta.unary.prop/is_standard_layout.pass.cpp | 48 +++++ .../meta.unary/meta.unary.prop/is_trivial.pass.cpp | 50 ++++++ .../is_trivially_assignable.pass.cpp | 53 ++++++ .../is_trivially_constructible.pass.cpp | 61 +++++++ .../is_trivially_copy_assignable.pass.cpp | 71 ++++++++ .../is_trivially_copy_constructible.pass.cpp | 73 ++++++++ .../meta.unary.prop/is_trivially_copyable.pass.cpp | 63 +++++++ .../is_trivially_default_constructible.pass.cpp | 76 ++++++++ .../is_trivially_destructible.pass.cpp | 83 +++++++++ .../is_trivially_move_assignable.pass.cpp | 71 ++++++++ .../is_trivially_move_constructible.pass.cpp | 89 ++++++++++ .../meta.unary.prop/is_unsigned.pass.cpp | 59 +++++++ .../meta.unary.prop/is_volatile.pass.cpp | 37 ++++ .../meta/meta.unary/nothing_to_do.pass.cpp | 12 ++ libcxx/test/std/utilities/meta/version.pass.cpp | 20 +++ 105 files changed, 6008 insertions(+) create mode 100644 libcxx/test/std/utilities/meta/meta.hel/integral_constant.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.rel/is_same.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.trans/nothing_to_do.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/meta.unary/nothing_to_do.pass.cpp create mode 100644 libcxx/test/std/utilities/meta/version.pass.cpp (limited to 'libcxx/test/std/utilities/meta') diff --git a/libcxx/test/std/utilities/meta/meta.hel/integral_constant.pass.cpp b/libcxx/test/std/utilities/meta/meta.hel/integral_constant.pass.cpp new file mode 100644 index 00000000000..1ad1adcc5cd --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.hel/integral_constant.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// integral_constant + +#include +#include + +int main() +{ + typedef std::integral_constant _5; + static_assert(_5::value == 5, ""); + static_assert((std::is_same<_5::value_type, int>::value), ""); + static_assert((std::is_same<_5::type, _5>::value), ""); +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + static_assert((_5() == 5), ""); +#else + assert(_5() == 5); +#endif + +#if _LIBCPP_STD_VER > 11 + static_assert ( _5{}() == 5, "" ); + static_assert ( std::true_type{}(), "" ); +#endif + + static_assert(std::false_type::value == false, ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + + static_assert(std::true_type::value == true, ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + + std::false_type f1; + std::false_type f2 = f1; + + std::true_type t1; + std::true_type t2 = t1; +} diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp new file mode 100644 index 00000000000..0f90ae5c1ca --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.rel/is_base_of.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_base_of + +#include + +template +void test_is_base_of() +{ + static_assert((std::is_base_of::value), ""); + static_assert((std::is_base_of::value), ""); + static_assert((std::is_base_of::value), ""); + static_assert((std::is_base_of::value), ""); +} + +template +void test_is_not_base_of() +{ + static_assert((!std::is_base_of::value), ""); +} + +struct B {}; +struct B1 : B {}; +struct B2 : B {}; +struct D : private B1, private B2 {}; + +int main() +{ + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); +} diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp new file mode 100644 index 00000000000..718e0ff18cf --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.rel/is_convertible.pass.cpp @@ -0,0 +1,189 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_convertible + +#include + +template +void test_is_convertible() +{ + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); +} + +template +void test_is_not_convertible() +{ + static_assert((!std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); +} + +typedef void Function(); +typedef char Array[1]; + +class NonCopyable { + NonCopyable(NonCopyable&); +}; + +int main() +{ + // void + test_is_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + // Function + test_is_not_convertible (); + test_is_not_convertible (); + test_is_convertible (); + test_is_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + // Function& + test_is_not_convertible (); + test_is_not_convertible (); + test_is_convertible (); + + test_is_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + // Function* + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_convertible (); + + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + // Array + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + + test_is_not_convertible (); + test_is_not_convertible (); + + static_assert(( std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + + // Array& + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + static_assert(( std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + + test_is_not_convertible (); + test_is_not_convertible (); + + static_assert(( std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + + // char + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + test_is_convertible (); + + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + + test_is_not_convertible (); + + // char& + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + test_is_convertible (); + + static_assert(( std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + + test_is_not_convertible (); + + // char* + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + test_is_not_convertible (); + + test_is_not_convertible (); + test_is_not_convertible (); + + static_assert(( std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); + static_assert(( std::is_convertible::value), ""); + + // NonCopyable + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((std::is_convertible::value), ""); + static_assert((!std::is_convertible::value), ""); +} diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_same.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_same.pass.cpp new file mode 100644 index 00000000000..7250d6ca773 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.rel/is_same.pass.cpp @@ -0,0 +1,59 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_same + +#include + +template +void test_is_same() +{ + static_assert((std::is_same::value), ""); + static_assert((!std::is_same::value), ""); + static_assert((!std::is_same::value), ""); + static_assert((std::is_same::value), ""); +} + +template +void test_is_same_ref() +{ + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); + static_assert((std::is_same::value), ""); +} + +template +void test_is_not_same() +{ + static_assert((!std::is_same::value), ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_same(); + test_is_same(); + test_is_same(); + test_is_same(); + test_is_same_ref(); + + test_is_not_same(); + test_is_not_same(); + test_is_not_same(); + test_is_not_same(); + test_is_not_same(); +} diff --git a/libcxx/test/std/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp b/libcxx/test/std/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..b58f5c55b64 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.rqmts/nothing_to_do.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp new file mode 100644 index 00000000000..28bbedee174 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_all_extents.pass.cpp @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_all_extents + +#include + +enum Enum {zero, one_}; + +template +void test_remove_all_extents() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); + test_remove_all_extents (); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp new file mode 100644 index 00000000000..c688c26b9a5 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.arr/remove_extent.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_extent + +#include + +enum Enum {zero, one_}; + +template +void test_remove_extent() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + + +int main() +{ + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); + test_remove_extent (); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp new file mode 100644 index 00000000000..19b1fb4d01b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_const.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_const + +#include + +template +void test_add_const_imp() +{ + static_assert((std::is_same::type, const U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +template +void test_add_const() +{ + test_add_const_imp(); + test_add_const_imp(); + test_add_const_imp(); + test_add_const_imp(); +} + +int main() +{ + test_add_const(); + test_add_const(); + test_add_const(); + test_add_const(); + test_add_const(); + test_add_const(); + test_add_const(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp new file mode 100644 index 00000000000..4905e518e12 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_cv.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_cv + +#include + +template +void test_add_cv_imp() +{ + static_assert((std::is_same::type, const volatile U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +template +void test_add_cv() +{ + test_add_cv_imp(); + test_add_cv_imp(); + test_add_cv_imp(); + test_add_cv_imp(); +} + +int main() +{ + test_add_cv(); + test_add_cv(); + test_add_cv(); + test_add_cv(); + test_add_cv(); + test_add_cv(); + test_add_cv(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp new file mode 100644 index 00000000000..7a12c44a2c6 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/add_volatile.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_volatile + +#include + +template +void test_add_volatile_imp() +{ + static_assert((std::is_same::type, volatile U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +template +void test_add_volatile() +{ + test_add_volatile_imp(); + test_add_volatile_imp(); + test_add_volatile_imp(); + test_add_volatile_imp(); +} + +int main() +{ + test_add_volatile(); + test_add_volatile(); + test_add_volatile(); + test_add_volatile(); + test_add_volatile(); + test_add_volatile(); + test_add_volatile(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp new file mode 100644 index 00000000000..cd2faf786d8 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_const + +#include + +template +void test_remove_const_imp() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +template +void test_remove_const() +{ + test_remove_const_imp(); + test_remove_const_imp(); + test_remove_const_imp(); + test_remove_const_imp(); +} + +int main() +{ + test_remove_const(); + test_remove_const(); + test_remove_const(); + test_remove_const(); + test_remove_const(); + test_remove_const(); + test_remove_const(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp new file mode 100644 index 00000000000..3f6405c8280 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_cv.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_cv + +#include + +template +void test_remove_cv_imp() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +template +void test_remove_cv() +{ + test_remove_cv_imp(); + test_remove_cv_imp(); + test_remove_cv_imp(); + test_remove_cv_imp(); +} + +int main() +{ + test_remove_cv(); + test_remove_cv(); + test_remove_cv(); + test_remove_cv(); + test_remove_cv(); + test_remove_cv(); + test_remove_cv(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp new file mode 100644 index 00000000000..6258a9039b4 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.cv/remove_volatile.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_volatile + +#include + +template +void test_remove_volatile_imp() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +template +void test_remove_volatile() +{ + test_remove_volatile_imp(); + test_remove_volatile_imp(); + test_remove_volatile_imp(); + test_remove_volatile_imp(); +} + +int main() +{ + test_remove_volatile(); + test_remove_volatile(); + test_remove_volatile(); + test_remove_volatile(); + test_remove_volatile(); + test_remove_volatile(); + test_remove_volatile(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp new file mode 100644 index 00000000000..c87e99c46e8 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp @@ -0,0 +1,194 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// aligned_storage + +#include + +int main() +{ + { + typedef std::aligned_storage<10, 1 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 1, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_storage<10, 2 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 2, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_storage<10, 4 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 12, ""); + } + { + typedef std::aligned_storage<10, 8 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 8, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<10, 16 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 16, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<10, 32 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 32, ""); + static_assert(sizeof(T1) == 32, ""); + } + { + typedef std::aligned_storage<20, 32 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 32, ""); + static_assert(sizeof(T1) == 32, ""); + } + { + typedef std::aligned_storage<40, 32 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 32, ""); + static_assert(sizeof(T1) == 64, ""); + } + { + typedef std::aligned_storage<12, 16 >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 16, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<1>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 1, ""); + static_assert(sizeof(T1) == 1, ""); + } + { + typedef std::aligned_storage<2>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 2, ""); + static_assert(sizeof(T1) == 2, ""); + } + { + typedef std::aligned_storage<3>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 2, ""); + static_assert(sizeof(T1) == 4, ""); + } + { + typedef std::aligned_storage<4>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 4, ""); + } + { + typedef std::aligned_storage<5>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 8, ""); + } + { + typedef std::aligned_storage<7>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 8, ""); + } + { + typedef std::aligned_storage<8>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 8, ""); + static_assert(sizeof(T1) == 8, ""); + } + { + typedef std::aligned_storage<9>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 8, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<15>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 8, ""); + static_assert(sizeof(T1) == 16, ""); + } + // Use alignof(std::max_align_t) below to find the max alignment instead of + // hardcoding it, because it's different on different platforms. + // (For example 8 on arm and 16 on x86.) +#if __cplusplus < 201103L +#define alignof __alignof__ +#endif + { + typedef std::aligned_storage<16>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == alignof(std::max_align_t), + ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_storage<17>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == alignof(std::max_align_t), + ""); + static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), ""); + } + { + typedef std::aligned_storage<10>::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 8, ""); + static_assert(sizeof(T1) == 16, ""); + } +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp new file mode 100644 index 00000000000..ae849ca5455 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp @@ -0,0 +1,92 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// aligned_union + +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_VARIADICS + { + typedef std::aligned_union<10, char >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 1, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_union<10, short >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 2, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_union<10, int >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 12, ""); + } + { + typedef std::aligned_union<10, double >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 8, ""); + static_assert(sizeof(T1) == 16, ""); + } + { + typedef std::aligned_union<10, short, char >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 2, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_union<10, char, short >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 2, ""); + static_assert(sizeof(T1) == 10, ""); + } + { + typedef std::aligned_union<2, int, char, short >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 4, ""); + } + { + typedef std::aligned_union<2, char, int, short >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 4, ""); + } + { + typedef std::aligned_union<2, char, short, int >::type T1; +#if _LIBCPP_STD_VER > 11 + static_assert(std::is_same, T1>::value, "" ); +#endif + static_assert(std::alignment_of::value == 4, ""); + static_assert(sizeof(T1) == 4, ""); + } +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp new file mode 100644 index 00000000000..91bf7e7654e --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// common_type + +#include + +int main() +{ + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, char>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, int>::value), ""); + static_assert((std::is_same, char>::value), ""); +#endif + + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + + static_assert((std::is_same::type, int>::value), ""); + static_assert((std::is_same::type, int>::value), ""); + + static_assert((std::is_same::type, long>::value), ""); + static_assert((std::is_same::type, long>::value), ""); + static_assert((std::is_same::type, long>::value), ""); + static_assert((std::is_same::type, long>::value), ""); + static_assert((std::is_same::type, long>::value), ""); + + static_assert((std::is_same::type, double>::value), ""); + static_assert((std::is_same::type, int>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, double>::value), ""); + static_assert((std::is_same, int>::value), ""); +#endif + + static_assert((std::is_same::type, double>::value), ""); + static_assert((std::is_same::type, long long>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, double>::value), ""); + static_assert((std::is_same, long long>::value), ""); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp new file mode 100644 index 00000000000..ac11e3a4ce8 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/conditional.pass.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// conditional + +#include + +int main() +{ + static_assert((std::is_same::type, char>::value), ""); + static_assert((std::is_same::type, int>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, char>::value), ""); + static_assert((std::is_same, int>::value), ""); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp new file mode 100644 index 00000000000..bd8ae0e297b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/decay.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// decay + +#include + +template +void test_decay() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_decay(); + test_decay(); + test_decay(); + test_decay(); + test_decay(); + test_decay(); + test_decay(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp new file mode 100644 index 00000000000..1ab07670fc2 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.fail.cpp @@ -0,0 +1,19 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enable_if + +#include + +int main() +{ + typedef std::enable_if::type A; +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp new file mode 100644 index 00000000000..eb72b0f393b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if.pass.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enable_if + +#include + +int main() +{ + static_assert((std::is_same::type, void>::value), ""); + static_assert((std::is_same::type, int>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, void>::value), ""); + static_assert((std::is_same, int>::value), ""); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp new file mode 100644 index 00000000000..8ce894578c4 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/enable_if2.fail.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enable_if + +#include + +int main() +{ +#if _LIBCPP_STD_VER > 11 + typedef std::enable_if_t A; +#else + static_assert ( false, "" ); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp new file mode 100644 index 00000000000..bf44c340ee5 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp @@ -0,0 +1,98 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// result_of + +#include +#include + +typedef bool (&PF1)(); +typedef short (*PF2)(long); + +struct S +{ + operator PF2() const; + double operator()(char, int&); + void calc(long) const; + char data_; +}; + +typedef void (S::*PMS)(long) const; +typedef char S::*PMD; + +struct wat +{ + wat& operator*() { return *this; } + void foo(); +}; + +struct F {}; + +template +void test_result_of_imp() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_result_of_imp (); + test_result_of_imp (); + test_result_of_imp (); + test_result_of_imp, int), void> (); + test_result_of_imp (); + test_result_of_imp (); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_result_of_imp (); +#endif + test_result_of_imp (); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_result_of_imp (); + test_result_of_imp (); + test_result_of_imp (); + test_result_of_imp (); + test_result_of_imp (); + test_result_of_imp (); +#endif +#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES + using type1 = std::result_of::type; +#endif +#if _LIBCPP_STD_VER > 11 + using type2 = std::result_of_t; +#endif + + + + static_assert((std::is_same::type, short>::value), "Error!"); + static_assert((std::is_same::type, double>::value), "Error!"); + static_assert((std::is_same::type, bool>::value), "Error!"); + static_assert((std::is_same, int)>::type, void>::value), "Error!"); + static_assert((std::is_same::type, void>::value), "Error!"); + static_assert((std::is_same::type, void>::value), "Error!"); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + static_assert((std::is_same::type, char&&>::value), "Error!"); +#endif + static_assert((std::is_same::type, const char&>::value), "Error!"); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + static_assert((std::is_same::type, int>::value), "Error!"); + static_assert((std::is_same::type, int>::value), "Error!"); + static_assert((std::is_same::type, int>::value), "Error!"); + static_assert((std::is_same::type, int>::value), "Error!"); + static_assert((std::is_same::type, int>::value), "Error!"); + static_assert((std::is_same::type, int>::value), "Error!"); +#endif +#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES + using type = std::result_of::type; +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp new file mode 100644 index 00000000000..728062b7068 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// underlying_type + +#include +#include + +enum E { V = INT_MIN }; +enum F { W = UINT_MAX }; + +int main() +{ + static_assert((std::is_same::type, int>::value), + "E has the wrong underlying type"); + static_assert((std::is_same::type, unsigned>::value), + "F has the wrong underlying type"); + +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, int>::value), ""); + static_assert((std::is_same, unsigned>::value), ""); +#endif + +#if __has_feature(cxx_strong_enums) + enum G : char { }; + + static_assert((std::is_same::type, char>::value), + "G has the wrong underlying type"); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, char>::value), ""); +#endif +#endif // __has_feature(cxx_strong_enums) +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp new file mode 100644 index 00000000000..76d0f12d03f --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/add_pointer.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_pointer + +#include + +template +void test_add_pointer() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_add_pointer(); + test_add_pointer(); + test_add_pointer(); + test_add_pointer(); + test_add_pointer(); + test_add_pointer(); + test_add_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp new file mode 100644 index 00000000000..9cecd39049f --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ptr/remove_pointer.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_pointer + +#include + +template +void test_remove_pointer() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); + test_remove_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp new file mode 100644 index 00000000000..8150ce04e37 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_lvalue_reference + +#include + +template +void test_add_lvalue_reference() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_add_lvalue_reference(); + test_add_lvalue_reference(); + test_add_lvalue_reference(); + test_add_lvalue_reference(); + test_add_lvalue_reference(); + test_add_lvalue_reference(); + test_add_lvalue_reference(); +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp new file mode 100644 index 00000000000..e8f08fdc398 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// add_rvalue_reference + +#include + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + +template +void test_add_rvalue_reference() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES + +int main() +{ +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_add_rvalue_reference(); + test_add_rvalue_reference(); + test_add_rvalue_reference(); + test_add_rvalue_reference(); + test_add_rvalue_reference(); + test_add_rvalue_reference(); + test_add_rvalue_reference(); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp new file mode 100644 index 00000000000..f9ebc37a5dd --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_reference + +#include + +template +void test_remove_reference() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); + test_remove_reference(); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp new file mode 100644 index 00000000000..eb8e31c76e1 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// make_signed + +#include + +enum Enum {zero, one_}; + +enum BigEnum +{ + bigzero, + big = 0xFFFFFFFFFFFFFFFFULL +}; + +#if !defined(_LIBCPP_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS) +enum HugeEnum : __uint128_t +{ + hugezero +}; +#endif + +template +void test_make_signed() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_make_signed< signed char, signed char >(); + test_make_signed< unsigned char, signed char >(); + test_make_signed< char, signed char >(); + test_make_signed< short, signed short >(); + test_make_signed< unsigned short, signed short >(); + test_make_signed< int, signed int >(); + test_make_signed< unsigned int, signed int >(); + test_make_signed< long, signed long >(); + test_make_signed< unsigned long, long >(); + test_make_signed< long long, signed long long >(); + test_make_signed< unsigned long long, signed long long >(); + test_make_signed< wchar_t, std::conditional::type >(); + test_make_signed< const wchar_t, std::conditional::type >(); + test_make_signed< const Enum, std::conditional::type >(); + test_make_signed< BigEnum, std::conditional::type >(); +#ifndef _LIBCPP_HAS_NO_INT128 + test_make_signed< __int128_t, __int128_t >(); + test_make_signed< __uint128_t, __int128_t >(); +# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS + test_make_signed< HugeEnum, __int128_t >(); +# endif +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp new file mode 100644 index 00000000000..984440193fa --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// make_unsigned + +#include + +enum Enum {zero, one_}; + +enum BigEnum +{ + bigzero, + big = 0xFFFFFFFFFFFFFFFFULL +}; + +#if !defined(_LIBCPP_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS) +enum HugeEnum : __int128_t +{ + hugezero +}; +#endif + +template +void test_make_unsigned() +{ + static_assert((std::is_same::type, U>::value), ""); +#if _LIBCPP_STD_VER > 11 + static_assert((std::is_same, U>::value), ""); +#endif +} + +int main() +{ + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned (); + test_make_unsigned::type> (); + test_make_unsigned::type> (); + test_make_unsigned::type >(); + test_make_unsigned::type> (); +#ifndef _LIBCPP_HAS_NO_INT128 + test_make_unsigned<__int128_t, __uint128_t>(); + test_make_unsigned<__uint128_t, __uint128_t>(); +# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS + test_make_unsigned(); +# endif +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.trans/nothing_to_do.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..b58f5c55b64 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.trans/nothing_to_do.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/std/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp b/libcxx/test/std/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..b58f5c55b64 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.type.synop/nothing_to_do.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp new file mode 100644 index 00000000000..6ea1cac789e --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// alignment_of + +#include +#include + +template +void test_alignment_of() +{ + static_assert( std::alignment_of::value == A, ""); + static_assert( std::alignment_of::value == A, ""); + static_assert( std::alignment_of::value == A, ""); + static_assert( std::alignment_of::value == A, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_alignment_of(); + test_alignment_of(); + test_alignment_of(); + test_alignment_of(); + test_alignment_of(); + test_alignment_of(); + test_alignment_of(); +#if (defined(__ppc__) && !defined(__ppc64__)) + test_alignment_of(); // 32-bit PPC has four byte bool +#else + test_alignment_of(); +#endif + test_alignment_of(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp new file mode 100644 index 00000000000..a99dc694852 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary.prop.query/extent.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// extent + +#include + +template +void test_extent() +{ + static_assert((std::extent::value == A), ""); + static_assert((std::extent::value == A), ""); + static_assert((std::extent::value == A), ""); + static_assert((std::extent::value == A), ""); +} + +template +void test_extent1() +{ + static_assert((std::extent::value == A), ""); + static_assert((std::extent::value == A), ""); + static_assert((std::extent::value == A), ""); + static_assert((std::extent::value == A), ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_extent(); + test_extent(); + test_extent(); + test_extent(); + test_extent(); + test_extent(); + test_extent(); + test_extent(); + test_extent(); + + test_extent(); + test_extent(); + test_extent(); + + test_extent1(); + test_extent1(); + test_extent1(); + test_extent1(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp new file mode 100644 index 00000000000..06f66a92c7c --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary.prop.query/rank.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// rank + +#include + +template +void test_rank() +{ + static_assert( std::rank::value == A, ""); + static_assert( std::rank::value == A, ""); + static_assert( std::rank::value == A, ""); + static_assert( std::rank::value == A, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_rank(); + test_rank(); + test_rank(); + test_rank(); + test_rank(); + test_rank(); + test_rank(); + test_rank(); + test_rank(); + + test_rank(); + test_rank(); + test_rank(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp new file mode 100644 index 00000000000..1f99a74d9b6 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary.prop.query/void_t.pass.cpp @@ -0,0 +1,69 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// void_t + +#include + +#if _LIBCPP_STD_VER <= 14 +int main () {} +#else + +template +void test1() +{ + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); +} + +template +void test2() +{ + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); + + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); + static_assert( std::is_same>::value, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + static_assert( std::is_same>::value, ""); + + test1(); + test1(); + test1(); + test1(); + test1(); + test1(); + test1(); + + test2(); + test2(); + test2(); + test2(); + test2(); + + static_assert( std::is_same>::value, ""); +} +#endif diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp new file mode 100644 index 00000000000..f4dd356383a --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/array.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// array + +#include + +template +void test_array_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert( std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_array() +{ + test_array_imp(); + test_array_imp(); + test_array_imp(); + test_array_imp(); +} + +typedef char array[3]; +typedef const char const_array[3]; +typedef char incomplete_array[]; + +int main() +{ + test_array(); + test_array(); + test_array(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp new file mode 100644 index 00000000000..0de00485572 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/class.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// class + +#include + +template +void test_class_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert( std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_class() +{ + test_class_imp(); + test_class_imp(); + test_class_imp(); + test_class_imp(); +} + +class Class +{ + int _; + double __; +}; + +int main() +{ + test_class(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp new file mode 100644 index 00000000000..7c9c78fcf2b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/enum.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enum + +#include + +template +void test_enum_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert( std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_enum() +{ + test_enum_imp(); + test_enum_imp(); + test_enum_imp(); + test_enum_imp(); +} + +enum Enum {zero, one}; + +int main() +{ + test_enum(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp new file mode 100644 index 00000000000..28664496031 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/floating_point.pass.cpp @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// floating_point + +#include + +template +void test_floating_point_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert( std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_floating_point() +{ + test_floating_point_imp(); + test_floating_point_imp(); + test_floating_point_imp(); + test_floating_point_imp(); +} + +int main() +{ + test_floating_point(); + test_floating_point(); + test_floating_point(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp new file mode 100644 index 00000000000..82757f5035b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/function.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// function + +#include + +template +void test_function_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert( std::is_function::value, ""); +} + +template +void test_function() +{ + test_function_imp(); + test_function_imp(); + test_function_imp(); + test_function_imp(); +} + +int main() +{ + test_function(); + test_function(); + test_function(); + test_function(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp new file mode 100644 index 00000000000..f68ed3ef7e5 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/integral.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// integral + +#include + +template +void test_integral_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert( std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_integral() +{ + test_integral_imp(); + test_integral_imp(); + test_integral_imp(); + test_integral_imp(); +} + +int main() +{ + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); +#ifndef _LIBCPP_HAS_NO_INT128 + test_integral<__int128_t>(); + test_integral<__uint128_t>(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp new file mode 100644 index 00000000000..3b6ccade7e7 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/lvalue_ref.pass.cpp @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// lvalue_ref + +#include + +template +void test_lvalue_ref() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert( std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +int main() +{ + test_lvalue_ref(); + test_lvalue_ref(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp new file mode 100644 index 00000000000..67ef3db2b71 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp @@ -0,0 +1,102 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_function_pointer + +#include + +template +void test_member_function_pointer_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert( std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_member_function_pointer() +{ + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); +} + +class Class +{ +}; + +int main() +{ + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + +#if __cplusplus >= 201103L +// reference qualifiers on functions are a C++11 extension + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp new file mode 100644 index 00000000000..e13e58632a3 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer_no_variadics.pass.cpp @@ -0,0 +1,76 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_function_pointer + +#define _LIBCPP_HAS_NO_VARIADICS +#include + +template +void test_member_function_pointer_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert( std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_member_function_pointer() +{ + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); +} + +class Class +{ +}; + +int main() +{ + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp new file mode 100644 index 00000000000..4e6699cc3e7 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_object_pointer.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_object_pointer + +#include + +template +void test_member_object_pointer_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert( std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_member_object_pointer() +{ + test_member_object_pointer_imp(); + test_member_object_pointer_imp(); + test_member_object_pointer_imp(); + test_member_object_pointer_imp(); +} + +class Class +{ +}; + +int main() +{ + test_member_object_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp new file mode 100644 index 00000000000..691e3536167 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/nullptr.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// nullptr_t +// is_null_pointer + +#include + +#if _LIBCPP_STD_VER > 11 +template +void test_nullptr_imp() +{ + static_assert(!std::is_void::value, ""); + static_assert( std::is_null_pointer::value, ""); + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_nullptr() +{ + test_nullptr_imp(); + test_nullptr_imp(); + test_nullptr_imp(); + test_nullptr_imp(); +} + +int main() +{ + test_nullptr(); +} +#else +int main() {} +#endif diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp new file mode 100644 index 00000000000..7073c106b44 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/pointer.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// pointer + +#include + +template +void test_pointer_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert( std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_pointer() +{ + test_pointer_imp(); + test_pointer_imp(); + test_pointer_imp(); + test_pointer_imp(); +} + +int main() +{ + test_pointer(); + test_pointer(); + test_pointer(); + test_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp new file mode 100644 index 00000000000..79644240363 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// rvalue_ref + +#include + +template +void test_rvalue_ref() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert( std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +int main() +{ +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_rvalue_ref(); + test_rvalue_ref(); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp new file mode 100644 index 00000000000..6cabb717c0c --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/union.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// union + +#include + +template +void test_union_imp() +{ + static_assert(!std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert( std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_union() +{ + test_union_imp(); + test_union_imp(); + test_union_imp(); + test_union_imp(); +} + +union Union +{ + int _; + double __; +}; + +int main() +{ + test_union(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp new file mode 100644 index 00000000000..f20bcf87ea1 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/void.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// void + +#include + +template +void test_void_imp() +{ + static_assert( std::is_void::value, ""); +#if _LIBCPP_STD_VER > 11 + static_assert(!std::is_null_pointer::value, ""); +#endif + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_function_pointer::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_function::value, ""); +} + +template +void test_void() +{ + test_void_imp(); + test_void_imp(); + test_void_imp(); + test_void_imp(); +} + +int main() +{ + test_void(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp new file mode 100644 index 00000000000..3476d5ceea2 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/array.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// array + +#include + +template +void test_array_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_array() +{ + test_array_imp(); + test_array_imp(); + test_array_imp(); + test_array_imp(); +} + +typedef char array[3]; +typedef const char const_array[3]; +typedef char incomplete_array[]; + +int main() +{ + test_array(); + test_array(); + test_array(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp new file mode 100644 index 00000000000..a77a10149d3 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/class.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// class + +#include + +template +void test_class_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_class() +{ + test_class_imp(); + test_class_imp(); + test_class_imp(); + test_class_imp(); +} + +class Class +{ + int _; + double __; +}; + +int main() +{ + test_class(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp new file mode 100644 index 00000000000..dc9e4874ab1 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/enum.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// enum + +#include + +template +void test_enum_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_enum() +{ + test_enum_imp(); + test_enum_imp(); + test_enum_imp(); + test_enum_imp(); +} + +enum Enum {zero, one}; + +int main() +{ + test_enum(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp new file mode 100644 index 00000000000..3560b456b00 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/floating_point.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// floating_point + +#include + +template +void test_floating_point_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert( std::is_arithmetic::value, ""); + static_assert( std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert(!std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_floating_point() +{ + test_floating_point_imp(); + test_floating_point_imp(); + test_floating_point_imp(); + test_floating_point_imp(); +} + +int main() +{ + test_floating_point(); + test_floating_point(); + test_floating_point(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp new file mode 100644 index 00000000000..fc8a1e5a8b2 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/function.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// function + +#include + +template +void test_function_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert(!std::is_object::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_function() +{ + test_function_imp(); + test_function_imp(); + test_function_imp(); + test_function_imp(); +} + +int main() +{ + test_function(); + test_function(); + test_function(); + test_function(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp new file mode 100644 index 00000000000..0bc94583ab0 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/integral.pass.cpp @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// integral + +#include + +template +void test_integral_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert( std::is_arithmetic::value, ""); + static_assert( std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert(!std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_integral() +{ + test_integral_imp(); + test_integral_imp(); + test_integral_imp(); + test_integral_imp(); +} + +int main() +{ + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); + test_integral(); +#ifndef _LIBCPP_HAS_NO_INT128 + test_integral<__int128_t>(); + test_integral<__uint128_t>(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp new file mode 100644 index 00000000000..dd812832f6c --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/lvalue_ref.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// lvalue_ref + +#include + +template +void test_lvalue_ref() +{ + static_assert( std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert(!std::is_object::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +int main() +{ + test_lvalue_ref(); + test_lvalue_ref(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp new file mode 100644 index 00000000000..0df21173c69 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_function_pointer.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_function_pointer + +#include + +template +void test_member_function_pointer_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert( std::is_member_pointer::value, ""); +} + +template +void test_member_function_pointer() +{ + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); + test_member_function_pointer_imp(); +} + +class Class +{ +}; + +int main() +{ + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp new file mode 100644 index 00000000000..a0dea4a9c44 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/member_object_pointer.pass.cpp @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// member_object_pointer + +#include + +template +void test_member_object_pointer_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert( std::is_member_pointer::value, ""); +} + +template +void test_member_object_pointer() +{ + test_member_object_pointer_imp(); + test_member_object_pointer_imp(); + test_member_object_pointer_imp(); + test_member_object_pointer_imp(); +} + +class Class +{ +}; + +int main() +{ + test_member_object_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp new file mode 100644 index 00000000000..de23da83637 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/pointer.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// pointer + +#include + +template +void test_pointer_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_pointer() +{ + test_pointer_imp(); + test_pointer_imp(); + test_pointer_imp(); + test_pointer_imp(); +} + +int main() +{ + test_pointer(); + test_pointer(); + test_pointer(); + test_pointer(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp new file mode 100644 index 00000000000..7563c2fd585 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// rvalue_ref + +#include + +template +void test_rvalue_ref() +{ + static_assert( std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert(!std::is_object::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +int main() +{ +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_rvalue_ref(); + test_rvalue_ref(); +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp new file mode 100644 index 00000000000..05db74c8aaf --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/union.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// union + +#include + +template +void test_union_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert( std::is_object::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert( std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_union() +{ + test_union_imp(); + test_union_imp(); + test_union_imp(); + test_union_imp(); +} + +union Union +{ + int _; + double __; +}; + +int main() +{ + test_union(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp new file mode 100644 index 00000000000..59569fe086b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/void.pass.cpp @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// void + +#include + +template +void test_void_imp() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert( std::is_fundamental::value, ""); + static_assert(!std::is_object::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert(!std::is_compound::value, ""); + static_assert(!std::is_member_pointer::value, ""); +} + +template +void test_void() +{ + test_void_imp(); + test_void_imp(); + test_void_imp(); + test_void_imp(); +} + +int main() +{ + test_void(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp new file mode 100644 index 00000000000..1c715e04970 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// extension + +// template struct __has_operator_addressof + + +#include + +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + +struct A +{ +}; + +struct B +{ + constexpr B* operator&() const; +}; + +struct D; + +struct C +{ + template + D operator,(U&&); +}; + +struct E +{ + constexpr C operator&() const; +}; + +struct F {}; +constexpr F* operator&(F const &) { return nullptr; } + +struct G {}; +constexpr G* operator&(G &&) { return nullptr; } + +struct H {}; +constexpr H* operator&(H const &&) { return nullptr; } + +struct J +{ + constexpr J* operator&() const &&; +}; + +#endif // _LIBCPP_HAS_NO_CONSTEXPR + +int main() +{ +#ifndef _LIBCPP_HAS_NO_CONSTEXPR + static_assert(std::__has_operator_addressof::value == false, ""); + static_assert(std::__has_operator_addressof::value == false, ""); + static_assert(std::__has_operator_addressof::value == true, ""); + static_assert(std::__has_operator_addressof::value == true, ""); + static_assert(std::__has_operator_addressof::value == true, ""); + static_assert(std::__has_operator_addressof::value == true, ""); + static_assert(std::__has_operator_addressof::value == true, ""); + static_assert(std::__has_operator_addressof::value == true, ""); +#endif // _LIBCPP_HAS_NO_CONSTEXPR +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp new file mode 100644 index 00000000000..685d30de692 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp @@ -0,0 +1,77 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_virtual_destructor + +#include + +template +void test_has_virtual_destructor() +{ + static_assert( std::has_virtual_destructor::value, ""); + static_assert( std::has_virtual_destructor::value, ""); + static_assert( std::has_virtual_destructor::value, ""); + static_assert( std::has_virtual_destructor::value, ""); +} + +template +void test_has_not_virtual_destructor() +{ + static_assert(!std::has_virtual_destructor::value, ""); + static_assert(!std::has_virtual_destructor::value, ""); + static_assert(!std::has_virtual_destructor::value, ""); + static_assert(!std::has_virtual_destructor::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + test_has_not_virtual_destructor(); + + test_has_virtual_destructor(); + test_has_virtual_destructor(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp new file mode 100644 index 00000000000..f2a8c23246b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_abstract + +#include + +template +void test_is_abstract() +{ + static_assert( std::is_abstract::value, ""); + static_assert( std::is_abstract::value, ""); + static_assert( std::is_abstract::value, ""); + static_assert( std::is_abstract::value, ""); +} + +template +void test_is_not_abstract() +{ + static_assert(!std::is_abstract::value, ""); + static_assert(!std::is_abstract::value, ""); + static_assert(!std::is_abstract::value, ""); + static_assert(!std::is_abstract::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +int main() +{ + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + test_is_not_abstract(); + + test_is_abstract(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp new file mode 100644 index 00000000000..b46a4d6bcc6 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_assignable + +#include + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +template +void test_is_assignable() +{ + static_assert(( std::is_assignable::value), ""); +} + +template +void test_is_not_assignable() +{ + static_assert((!std::is_assignable::value), ""); +} + +struct D; + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +struct C +{ + template + D operator,(U&&); +}; + +struct E +{ + C operator=(int); +}; +#endif + +int main() +{ + test_is_assignable (); + test_is_assignable (); + test_is_assignable (); + test_is_assignable (); + test_is_assignable (); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_is_assignable (); + + test_is_not_assignable (); + test_is_not_assignable (); +#endif + test_is_not_assignable (); + test_is_not_assignable (); + test_is_not_assignable (); + test_is_not_assignable (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp new file mode 100644 index 00000000000..72f2ff45892 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_const + +#include + +template +void test_is_const() +{ + static_assert(!std::is_const::value, ""); + static_assert( std::is_const::value, ""); + static_assert(!std::is_const::value, ""); + static_assert( std::is_const::value, ""); +} + +int main() +{ + test_is_const(); + test_is_const(); + test_is_const(); + test_is_const(); + test_is_const(); + test_is_const(); + test_is_const(); + + static_assert(!std::is_const::value, ""); + static_assert(!std::is_const::value, ""); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp new file mode 100644 index 00000000000..2b8f7efec60 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp @@ -0,0 +1,86 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// template +// struct is_constructible; + +#include + +struct A +{ + explicit A(int); + A(int, double); +#if __has_feature(cxx_access_control_sfinae) +private: +#endif + A(char); +}; + +class Abstract +{ + virtual void foo() = 0; +}; + +class AbstractDestructor +{ + virtual ~AbstractDestructor() = 0; +}; + +template +void test_is_constructible() +{ + static_assert( (std::is_constructible::value), ""); +} + +template +void test_is_constructible() +{ + static_assert( (std::is_constructible::value), ""); +} + +template +void test_is_constructible() +{ + static_assert( (std::is_constructible::value), ""); +} + +template +void test_is_not_constructible() +{ + static_assert((!std::is_constructible::value), ""); +} + +template +void test_is_not_constructible() +{ + static_assert((!std::is_constructible::value), ""); +} + +int main() +{ + test_is_constructible (); + test_is_constructible (); + test_is_constructible (); + test_is_constructible (); + test_is_constructible (); + + test_is_not_constructible (); +#if __has_feature(cxx_access_control_sfinae) + test_is_not_constructible (); +#else + test_is_constructible (); +#endif + test_is_not_constructible (); + test_is_not_constructible (); + test_is_not_constructible (); + test_is_not_constructible (); + test_is_not_constructible (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp new file mode 100644 index 00000000000..c43d59479fb --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp @@ -0,0 +1,80 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_copy_assignable + +#include + +template +void test_is_copy_assignable() +{ + static_assert(( std::is_copy_assignable::value), ""); +} + +template +void test_is_not_copy_assignable() +{ + static_assert((!std::is_copy_assignable::value), ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +class B +{ + B& operator=(const B&); +}; + +struct C +{ + void operator=(C&); // not const +}; + +int main() +{ + test_is_copy_assignable (); + test_is_copy_assignable (); + test_is_copy_assignable (); + test_is_copy_assignable (); + test_is_copy_assignable (); + test_is_copy_assignable (); + test_is_copy_assignable (); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_is_not_copy_assignable (); + test_is_not_copy_assignable (); + test_is_not_copy_assignable (); +#endif +#if __has_feature(cxx_access_control_sfinae) + test_is_not_copy_assignable (); +#endif + test_is_not_copy_assignable (); + test_is_not_copy_assignable (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp new file mode 100644 index 00000000000..f878a50c3af --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp @@ -0,0 +1,88 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_copy_constructible + +#include + +template +void test_is_copy_constructible() +{ + static_assert( std::is_copy_constructible::value, ""); +} + +template +void test_is_not_copy_constructible() +{ + static_assert(!std::is_copy_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +class B +{ + B(const B&); +}; + +struct C +{ + C(C&); // not const + void operator=(C&); // not const +}; + +int main() +{ + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + test_is_copy_constructible(); + + test_is_not_copy_constructible(); + test_is_not_copy_constructible(); + test_is_not_copy_constructible(); + test_is_not_copy_constructible(); + test_is_not_copy_constructible(); +#if __has_feature(cxx_access_control_sfinae) + test_is_not_copy_constructible(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp new file mode 100644 index 00000000000..e7d2e3a5503 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp @@ -0,0 +1,93 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_default_constructible + +#include + +template +void test_is_default_constructible() +{ + static_assert( std::is_default_constructible::value, ""); + static_assert( std::is_default_constructible::value, ""); + static_assert( std::is_default_constructible::value, ""); + static_assert( std::is_default_constructible::value, ""); +} + +template +void test_is_not_default_constructible() +{ + static_assert(!std::is_default_constructible::value, ""); + static_assert(!std::is_default_constructible::value, ""); + static_assert(!std::is_default_constructible::value, ""); + static_assert(!std::is_default_constructible::value, ""); +} + +class Empty +{ +}; + +class NoDefaultConstructor +{ + NoDefaultConstructor(int) {} +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +class B +{ + B(); +}; + +int main() +{ + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + test_is_default_constructible(); + + test_is_not_default_constructible(); + test_is_not_default_constructible(); + test_is_not_default_constructible(); + test_is_not_default_constructible(); + test_is_not_default_constructible(); +#if __has_feature(cxx_access_control_sfinae) + test_is_not_default_constructible(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp new file mode 100644 index 00000000000..807745ef66c --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp @@ -0,0 +1,121 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_destructible + +#include + +template +void test_is_destructible() +{ + static_assert( std::is_destructible::value, ""); + static_assert( std::is_destructible::value, ""); + static_assert( std::is_destructible::value, ""); + static_assert( std::is_destructible::value, ""); +} + +template +void test_is_not_destructible() +{ + static_assert(!std::is_destructible::value, ""); + static_assert(!std::is_destructible::value, ""); + static_assert(!std::is_destructible::value, ""); + static_assert(!std::is_destructible::value, ""); +} + +class Empty {}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + ~A(); +}; + +typedef void (Function) (); + +struct PublicAbstract { public: virtual void foo() = 0; }; +struct ProtectedAbstract { protected: virtual void foo() = 0; }; +struct PrivateAbstract { private: virtual void foo() = 0; }; + +struct PublicDestructor { public: ~PublicDestructor() {}}; +struct ProtectedDestructor { protected: ~ProtectedDestructor() {}}; +struct PrivateDestructor { private: ~PrivateDestructor() {}}; + +struct VirtualPublicDestructor { public: virtual ~VirtualPublicDestructor() {}}; +struct VirtualProtectedDestructor { protected: virtual ~VirtualProtectedDestructor() {}}; +struct VirtualPrivateDestructor { private: virtual ~VirtualPrivateDestructor() {}}; + +struct PurePublicDestructor { public: virtual ~PurePublicDestructor() = 0; }; +struct PureProtectedDestructor { protected: virtual ~PureProtectedDestructor() = 0; }; +struct PurePrivateDestructor { private: virtual ~PurePrivateDestructor() = 0; }; + +struct DeletedPublicDestructor { public: ~DeletedPublicDestructor() = delete; }; +struct DeletedProtectedDestructor { protected: ~DeletedProtectedDestructor() = delete; }; +struct DeletedPrivateDestructor { private: ~DeletedPrivateDestructor() = delete; }; + +struct DeletedVirtualPublicDestructor { public: virtual ~DeletedVirtualPublicDestructor() = delete; }; +struct DeletedVirtualProtectedDestructor { protected: virtual ~DeletedVirtualProtectedDestructor() = delete; }; +struct DeletedVirtualPrivateDestructor { private: virtual ~DeletedVirtualPrivateDestructor() = delete; }; + + +int main() +{ + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + test_is_destructible(); + + test_is_not_destructible(); + test_is_not_destructible(); + + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + test_is_not_destructible(); + +// test_is_not_destructible(); // currently fails due to clang bug #20268 + test_is_not_destructible(); + test_is_not_destructible(); + +#if __has_feature(cxx_access_control_sfinae) + test_is_not_destructible(); +#endif + test_is_not_destructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp new file mode 100644 index 00000000000..47af3c45cde --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_empty + +#include + +template +void test_is_empty() +{ + static_assert( std::is_empty::value, ""); + static_assert( std::is_empty::value, ""); + static_assert( std::is_empty::value, ""); + static_assert( std::is_empty::value, ""); +} + +template +void test_is_not_empty() +{ + static_assert(!std::is_empty::value, ""); + static_assert(!std::is_empty::value, ""); + static_assert(!std::is_empty::value, ""); + static_assert(!std::is_empty::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +int main() +{ + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + test_is_not_empty(); + + test_is_empty(); + test_is_empty(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp new file mode 100644 index 00000000000..cf32196213e --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_final + +#include + +#if _LIBCPP_STD_VER > 11 + +struct P final { }; +union U1 { }; +union U2 final { }; + +template +void test_is_final() +{ + static_assert( std::is_final::value, ""); + static_assert( std::is_final::value, ""); + static_assert( std::is_final::value, ""); + static_assert( std::is_final::value, ""); +} + +template +void test_is_not_final() +{ + static_assert(!std::is_final::value, ""); + static_assert(!std::is_final::value, ""); + static_assert(!std::is_final::value, ""); + static_assert(!std::is_final::value, ""); +} + +int main () +{ + test_is_not_final(); + test_is_not_final(); + test_is_final

(); + test_is_not_final(); + test_is_not_final(); + test_is_not_final(); + test_is_final (); + test_is_not_final(); +} +#else +int main () {} +#endif diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp new file mode 100644 index 00000000000..ce781cd936b --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp @@ -0,0 +1,46 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_literal_type + +#include + +template +void test_is_literal_type() +{ + static_assert( std::is_literal_type::value, ""); +} + +template +void test_is_not_literal_type() +{ + static_assert(!std::is_literal_type::value, ""); +} + +struct A +{ +}; + +struct B +{ + B(); +}; + +int main() +{ + test_is_literal_type (); + test_is_literal_type (); + test_is_literal_type (); + test_is_literal_type (); + test_is_literal_type (); + + test_is_not_literal_type (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp new file mode 100644 index 00000000000..a89ee7d4e49 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_move_assignable + +#include + +template +void test_is_move_assignable() +{ + static_assert( std::is_move_assignable::value, ""); +} + +template +void test_is_not_move_assignable() +{ + static_assert(!std::is_move_assignable::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_is_move_assignable (); + test_is_move_assignable (); + test_is_move_assignable (); + test_is_move_assignable (); + test_is_move_assignable (); + test_is_move_assignable (); + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_is_not_move_assignable (); + test_is_not_move_assignable (); + test_is_not_move_assignable (); +#endif + test_is_not_move_assignable (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp new file mode 100644 index 00000000000..7409ebaa56c --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp @@ -0,0 +1,81 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_move_constructible + +#include + +template +void test_is_move_constructible() +{ + static_assert( std::is_move_constructible::value, ""); +} + +template +void test_is_not_move_constructible() +{ + static_assert(!std::is_move_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +struct B +{ +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + B(B&&); +#endif +}; + +int main() +{ + test_is_not_move_constructible(); + test_is_not_move_constructible(); + test_is_not_move_constructible(); + test_is_not_move_constructible(); + + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); + test_is_move_constructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp new file mode 100644 index 00000000000..8fff5f8b3de --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_assignable + +#include + +template +void test_is_nothrow_assignable() +{ + static_assert(( std::is_nothrow_assignable::value), ""); +} + +template +void test_is_not_nothrow_assignable() +{ + static_assert((!std::is_nothrow_assignable::value), ""); +} + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +struct C +{ + void operator=(C&); // not const +}; + +int main() +{ + test_is_nothrow_assignable (); + test_is_nothrow_assignable (); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_is_nothrow_assignable (); +#endif + + test_is_not_nothrow_assignable (); + test_is_not_nothrow_assignable (); + test_is_not_nothrow_assignable (); + test_is_not_nothrow_assignable (); + test_is_not_nothrow_assignable (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp new file mode 100644 index 00000000000..fe0b5673bc4 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp @@ -0,0 +1,103 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// template +// struct is_nothrow_constructible; + +#include + +template +void test_is_nothrow_constructible() +{ + static_assert(( std::is_nothrow_constructible::value), ""); +} + +template +void test_is_nothrow_constructible() +{ + static_assert(( std::is_nothrow_constructible::value), ""); +} + +template +void test_is_not_nothrow_constructible() +{ + static_assert((!std::is_nothrow_constructible::value), ""); +} + +template +void test_is_not_nothrow_constructible() +{ + static_assert((!std::is_nothrow_constructible::value), ""); +} + +template +void test_is_not_nothrow_constructible() +{ + static_assert((!std::is_nothrow_constructible::value), ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +struct C +{ + C(C&); // not const + void operator=(C&); // not const +}; + +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +struct Tuple { + Tuple(Empty&&) noexcept {} +}; +#endif + +int main() +{ + test_is_nothrow_constructible (); + test_is_nothrow_constructible (); + test_is_nothrow_constructible (); + test_is_nothrow_constructible (); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + test_is_nothrow_constructible (); // See bug #19616. +#endif + + test_is_not_nothrow_constructible (); + test_is_not_nothrow_constructible (); + test_is_not_nothrow_constructible (); + test_is_not_nothrow_constructible (); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + static_assert(!std::is_constructible::value, ""); + test_is_not_nothrow_constructible (); // See bug #19616. +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp new file mode 100644 index 00000000000..d843803cf21 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_copy_assignable + +#include + +template +void test_has_nothrow_assign() +{ + static_assert( std::is_nothrow_copy_assignable::value, ""); +} + +template +void test_has_not_nothrow_assign() +{ + static_assert(!std::is_nothrow_copy_assignable::value, ""); +} + +class Empty +{ +}; + +struct NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + + test_has_not_nothrow_assign(); + test_has_not_nothrow_assign(); + test_has_not_nothrow_assign(); + +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp new file mode 100644 index 00000000000..99fce65dcc7 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_copy_constructible + +#include + +template +void test_is_nothrow_copy_constructible() +{ + static_assert( std::is_nothrow_copy_constructible::value, ""); + static_assert( std::is_nothrow_copy_constructible::value, ""); +} + +template +void test_has_not_nothrow_copy_constructor() +{ + static_assert(!std::is_nothrow_copy_constructible::value, ""); + static_assert(!std::is_nothrow_copy_constructible::value, ""); + static_assert(!std::is_nothrow_copy_constructible::value, ""); + static_assert(!std::is_nothrow_copy_constructible::value, ""); +} + +class Empty +{ +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_nothrow_copy_constructor(); + test_has_not_nothrow_copy_constructor(); + + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); + test_is_nothrow_copy_constructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp new file mode 100644 index 00000000000..1550dff08bb --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_default_constructible + +#include + +template +void test_is_nothrow_default_constructible() +{ + static_assert( std::is_nothrow_default_constructible::value, ""); + static_assert( std::is_nothrow_default_constructible::value, ""); + static_assert( std::is_nothrow_default_constructible::value, ""); + static_assert( std::is_nothrow_default_constructible::value, ""); +} + +template +void test_has_not_nothrow_default_constructor() +{ + static_assert(!std::is_nothrow_default_constructible::value, ""); + static_assert(!std::is_nothrow_default_constructible::value, ""); + static_assert(!std::is_nothrow_default_constructible::value, ""); + static_assert(!std::is_nothrow_default_constructible::value, ""); +} + +class Empty +{ +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_nothrow_default_constructor(); + test_has_not_nothrow_default_constructor(); + test_has_not_nothrow_default_constructor(); + + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); + test_is_nothrow_default_constructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp new file mode 100644 index 00000000000..8fd5bab5a01 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp @@ -0,0 +1,91 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_nothrow_destructible + +#include + +template +void test_is_nothrow_destructible() +{ + static_assert( std::is_nothrow_destructible::value, ""); + static_assert( std::is_nothrow_destructible::value, ""); + static_assert( std::is_nothrow_destructible::value, ""); + static_assert( std::is_nothrow_destructible::value, ""); +} + +template +void test_is_not_nothrow_destructible() +{ + static_assert(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); + static_assert(!std::is_nothrow_destructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual void foo() = 0; +}; + +class AbstractDestructor +{ + virtual ~AbstractDestructor() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_is_not_nothrow_destructible(); + test_is_not_nothrow_destructible(); + test_is_not_nothrow_destructible(); + test_is_not_nothrow_destructible(); + +#if __has_feature(cxx_noexcept) + test_is_nothrow_destructible(); +#endif + test_is_nothrow_destructible(); +#if __has_feature(cxx_unrestricted_unions) + test_is_nothrow_destructible(); +#endif +#if __has_feature(cxx_access_control_sfinae) + test_is_nothrow_destructible(); +#endif + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); + test_is_nothrow_destructible(); +#if __has_feature(cxx_noexcept) + test_is_nothrow_destructible(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp new file mode 100644 index 00000000000..fe51e438864 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_move_assign + +#include + +template +void test_has_nothrow_assign() +{ + static_assert( std::is_nothrow_move_assignable::value, ""); +} + +template +void test_has_not_nothrow_assign() +{ + static_assert(!std::is_nothrow_move_assignable::value, ""); +} + +class Empty +{ +}; + +struct NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + test_has_nothrow_assign(); + + test_has_not_nothrow_assign(); + test_has_not_nothrow_assign(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp new file mode 100644 index 00000000000..f5a42afe0d5 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// has_nothrow_move_constructor + +#include + +template +void test_is_nothrow_move_constructible() +{ + static_assert( std::is_nothrow_move_constructible::value, ""); + static_assert( std::is_nothrow_move_constructible::value, ""); +} + +template +void test_has_not_nothrow_move_constructor() +{ + static_assert(!std::is_nothrow_move_constructible::value, ""); + static_assert(!std::is_nothrow_move_constructible::value, ""); + static_assert(!std::is_nothrow_move_constructible::value, ""); + static_assert(!std::is_nothrow_move_constructible::value, ""); +} + +class Empty +{ +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_nothrow_move_constructor(); + test_has_not_nothrow_move_constructor(); + + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); + test_is_nothrow_move_constructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp new file mode 100644 index 00000000000..4ec1ae9949e --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_pod + +#include + +template +void test_is_pod() +{ + static_assert( std::is_pod::value, ""); + static_assert( std::is_pod::value, ""); + static_assert( std::is_pod::value, ""); + static_assert( std::is_pod::value, ""); +} + +template +void test_is_not_pod() +{ + static_assert(!std::is_pod::value, ""); + static_assert(!std::is_pod::value, ""); + static_assert(!std::is_pod::value, ""); + static_assert(!std::is_pod::value, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_not_pod(); + test_is_not_pod(); + test_is_not_pod(); + + test_is_pod(); + test_is_pod(); + test_is_pod(); + test_is_pod(); + test_is_pod(); + test_is_pod(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp new file mode 100644 index 00000000000..6e82cddc516 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp @@ -0,0 +1,82 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_polymorphic + +#include + +template +void test_is_polymorphic() +{ + static_assert( std::is_polymorphic::value, ""); + static_assert( std::is_polymorphic::value, ""); + static_assert( std::is_polymorphic::value, ""); + static_assert( std::is_polymorphic::value, ""); +} + +template +void test_is_not_polymorphic() +{ + static_assert(!std::is_polymorphic::value, ""); + static_assert(!std::is_polymorphic::value, ""); + static_assert(!std::is_polymorphic::value, ""); + static_assert(!std::is_polymorphic::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +#if __has_feature(cxx_attributes) +class Final final { +}; +#else +class Final { +}; +#endif + +int main() +{ + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + test_is_not_polymorphic(); + + test_is_polymorphic(); + test_is_polymorphic(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp new file mode 100644 index 00000000000..479c2529f02 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp @@ -0,0 +1,59 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_signed + +#include + +template +void test_is_signed() +{ + static_assert( std::is_signed::value, ""); + static_assert( std::is_signed::value, ""); + static_assert( std::is_signed::value, ""); + static_assert( std::is_signed::value, ""); +} + +template +void test_is_not_signed() +{ + static_assert(!std::is_signed::value, ""); + static_assert(!std::is_signed::value, ""); + static_assert(!std::is_signed::value, ""); + static_assert(!std::is_signed::value, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_not_signed(); + test_is_not_signed(); + test_is_not_signed(); + test_is_not_signed(); + test_is_not_signed(); + test_is_not_signed(); + test_is_not_signed(); + test_is_not_signed(); + test_is_not_signed(); + + test_is_signed(); + test_is_signed(); + +#ifndef _LIBCPP_HAS_NO_INT128 + test_is_signed<__int128_t>(); + test_is_not_signed<__uint128_t>(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp new file mode 100644 index 00000000000..668c4cdc7dd --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_standard_layout + +#include + +template +void test_is_standard_layout() +{ + static_assert( std::is_standard_layout::value, ""); + static_assert( std::is_standard_layout::value, ""); + static_assert( std::is_standard_layout::value, ""); + static_assert( std::is_standard_layout::value, ""); +} + +template +void test_is_not_standard_layout() +{ + static_assert(!std::is_standard_layout::value, ""); + static_assert(!std::is_standard_layout::value, ""); + static_assert(!std::is_standard_layout::value, ""); + static_assert(!std::is_standard_layout::value, ""); +} + +template +struct pair +{ + T1 first; + T2 second; +}; + +int main() +{ + test_is_standard_layout (); + test_is_standard_layout (); + test_is_standard_layout > (); + + test_is_not_standard_layout (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp new file mode 100644 index 00000000000..af38699d881 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivial + +#include + +template +void test_is_trivial() +{ + static_assert( std::is_trivial::value, ""); + static_assert( std::is_trivial::value, ""); + static_assert( std::is_trivial::value, ""); + static_assert( std::is_trivial::value, ""); +} + +template +void test_is_not_trivial() +{ + static_assert(!std::is_trivial::value, ""); + static_assert(!std::is_trivial::value, ""); + static_assert(!std::is_trivial::value, ""); + static_assert(!std::is_trivial::value, ""); +} + +struct A {}; + +class B +{ +public: + B(); +}; + +int main() +{ + test_is_trivial (); + test_is_trivial (); + + test_is_not_trivial (); + test_is_not_trivial (); + test_is_not_trivial (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp new file mode 100644 index 00000000000..735d05fa6ee --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_assignable + +#include + +template +void test_is_trivially_assignable() +{ + static_assert(( std::is_trivially_assignable::value), ""); +} + +template +void test_is_not_trivially_assignable() +{ + static_assert((!std::is_trivially_assignable::value), ""); +} + +struct A +{ +}; + +struct B +{ + void operator=(A); +}; + +struct C +{ + void operator=(C&); // not const +}; + +int main() +{ + test_is_trivially_assignable (); + test_is_trivially_assignable (); + test_is_trivially_assignable (); + + test_is_not_trivially_assignable (); + test_is_not_trivially_assignable (); + test_is_not_trivially_assignable (); + test_is_not_trivially_assignable (); + test_is_not_trivially_assignable (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp new file mode 100644 index 00000000000..4171d4d32f5 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// template +// struct is_trivially_constructible; + +#include + +template +void test_is_trivially_constructible() +{ + static_assert(( std::is_trivially_constructible::value), ""); +} + +template +void test_is_trivially_constructible() +{ + static_assert(( std::is_trivially_constructible::value), ""); +} + +template +void test_is_not_trivially_constructible() +{ + static_assert((!std::is_trivially_constructible::value), ""); +} + +template +void test_is_not_trivially_constructible() +{ + static_assert((!std::is_trivially_constructible::value), ""); +} + +template +void test_is_not_trivially_constructible() +{ + static_assert((!std::is_trivially_constructible::value), ""); +} + +struct A +{ + explicit A(int); + A(int, double); +}; + +int main() +{ + test_is_trivially_constructible (); + test_is_trivially_constructible (); + + test_is_not_trivially_constructible (); + test_is_not_trivially_constructible (); + test_is_not_trivially_constructible (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp new file mode 100644 index 00000000000..7d72565e40c --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_copy_assignable + +#include + +template +void test_has_trivially_copy_assignable() +{ + static_assert( std::is_trivially_copy_assignable::value, ""); +} + +template +void test_has_not_trivially_copy_assignable() +{ + static_assert(!std::is_trivially_copy_assignable::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_trivially_copy_assignable(); + test_has_trivially_copy_assignable(); + test_has_trivially_copy_assignable(); + test_has_trivially_copy_assignable(); + test_has_trivially_copy_assignable(); + test_has_trivially_copy_assignable(); + test_has_trivially_copy_assignable(); + test_has_trivially_copy_assignable(); + + test_has_not_trivially_copy_assignable(); + test_has_not_trivially_copy_assignable(); + test_has_not_trivially_copy_assignable(); + test_has_not_trivially_copy_assignable(); + test_has_not_trivially_copy_assignable(); + +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp new file mode 100644 index 00000000000..6bd78ec9e7a --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp @@ -0,0 +1,73 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_copy_constructible + +#include + +template +void test_is_trivially_copy_constructible() +{ + static_assert( std::is_trivially_copy_constructible::value, ""); + static_assert( std::is_trivially_copy_constructible::value, ""); +} + +template +void test_has_not_trivial_copy_constructor() +{ + static_assert(!std::is_trivially_copy_constructible::value, ""); + static_assert(!std::is_trivially_copy_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +int main() +{ + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + test_has_not_trivial_copy_constructor(); + + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); + test_is_trivially_copy_constructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp new file mode 100644 index 00000000000..d65882378fc --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_copyable + +#include +#include + +template +void test_is_trivially_copyable() +{ + static_assert( std::is_trivially_copyable::value, ""); + static_assert( std::is_trivially_copyable::value, ""); + static_assert(!std::is_trivially_copyable::value, ""); + static_assert(!std::is_trivially_copyable::value, ""); +} + +template +void test_is_not_trivially_copyable() +{ + static_assert(!std::is_trivially_copyable::value, ""); + static_assert(!std::is_trivially_copyable::value, ""); + static_assert(!std::is_trivially_copyable::value, ""); + static_assert(!std::is_trivially_copyable::value, ""); +} + +struct A +{ + int i_; +}; + +struct B +{ + int i_; + ~B() {assert(i_ == 0);} +}; + +class C +{ +public: + C(); +}; + +int main() +{ + test_is_trivially_copyable (); + test_is_trivially_copyable (); + test_is_trivially_copyable (); + test_is_trivially_copyable (); + test_is_trivially_copyable (); + + test_is_not_trivially_copyable (); + test_is_not_trivially_copyable (); + test_is_not_trivially_copyable (); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp new file mode 100644 index 00000000000..1f63401dacb --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp @@ -0,0 +1,76 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_default_constructible + +#include + +template +void test_is_trivially_default_constructible() +{ + static_assert( std::is_trivially_default_constructible::value, ""); + static_assert( std::is_trivially_default_constructible::value, ""); + static_assert( std::is_trivially_default_constructible::value, ""); + static_assert( std::is_trivially_default_constructible::value, ""); +} + +template +void test_has_not_trivial_default_constructor() +{ + static_assert(!std::is_trivially_default_constructible::value, ""); + static_assert(!std::is_trivially_default_constructible::value, ""); + static_assert(!std::is_trivially_default_constructible::value, ""); + static_assert(!std::is_trivially_default_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A(); +}; + +int main() +{ + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + test_has_not_trivial_default_constructor(); + + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); + test_is_trivially_default_constructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp new file mode 100644 index 00000000000..b18ace44bda --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp @@ -0,0 +1,83 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_destructible + +#include + +template +void test_is_trivially_destructible() +{ + static_assert( std::is_trivially_destructible::value, ""); + static_assert( std::is_trivially_destructible::value, ""); + static_assert( std::is_trivially_destructible::value, ""); + static_assert( std::is_trivially_destructible::value, ""); +} + +template +void test_is_not_trivially_destructible() +{ + static_assert(!std::is_trivially_destructible::value, ""); + static_assert(!std::is_trivially_destructible::value, ""); + static_assert(!std::is_trivially_destructible::value, ""); + static_assert(!std::is_trivially_destructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual void foo() = 0; +}; + +class AbstractDestructor +{ + virtual ~AbstractDestructor() = 0; +}; + +struct A +{ + ~A(); +}; + +int main() +{ + test_is_not_trivially_destructible(); + test_is_not_trivially_destructible(); + test_is_not_trivially_destructible(); + test_is_not_trivially_destructible(); + test_is_not_trivially_destructible(); + + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); + test_is_trivially_destructible(); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp new file mode 100644 index 00000000000..c3fc7ac0a3d --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp @@ -0,0 +1,71 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_move_assignable + +#include + +template +void test_has_trivial_assign() +{ + static_assert( std::is_trivially_move_assignable::value, ""); +} + +template +void test_has_not_trivial_assign() +{ + static_assert(!std::is_trivially_move_assignable::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +struct A +{ + A& operator=(const A&); +}; + +int main() +{ + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + test_has_trivial_assign(); + + test_has_not_trivial_assign(); + test_has_not_trivial_assign(); + test_has_not_trivial_assign(); + test_has_not_trivial_assign(); + test_has_not_trivial_assign(); + +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp new file mode 100644 index 00000000000..54cb5e853a8 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp @@ -0,0 +1,89 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_trivially_move_constructible + +#include + +template +void test_is_trivially_move_constructible() +{ + static_assert( std::is_trivially_move_constructible::value, ""); +} + +template +void test_has_not_trivial_move_constructor() +{ + static_assert(!std::is_trivially_move_constructible::value, ""); +} + +class Empty +{ +}; + +class NotEmpty +{ +public: + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ +public: + virtual ~Abstract() = 0; +}; + +struct A +{ + A(const A&); +}; + +#if __has_feature(cxx_defaulted_functions) + +struct MoveOnly1 +{ + MoveOnly1(MoveOnly1&&); +}; + +struct MoveOnly2 +{ + MoveOnly2(MoveOnly2&&) = default; +}; + +#endif + +int main() +{ + test_has_not_trivial_move_constructor(); + test_has_not_trivial_move_constructor(); + test_has_not_trivial_move_constructor(); + test_has_not_trivial_move_constructor(); + + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + test_is_trivially_move_constructible(); + +#if __has_feature(cxx_defaulted_functions) + static_assert(!std::is_trivially_move_constructible::value, ""); + static_assert( std::is_trivially_move_constructible::value, ""); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp new file mode 100644 index 00000000000..dfdb1554261 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp @@ -0,0 +1,59 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_unsigned + +#include + +template +void test_is_unsigned() +{ + static_assert( std::is_unsigned::value, ""); + static_assert( std::is_unsigned::value, ""); + static_assert( std::is_unsigned::value, ""); + static_assert( std::is_unsigned::value, ""); +} + +template +void test_is_not_unsigned() +{ + static_assert(!std::is_unsigned::value, ""); + static_assert(!std::is_unsigned::value, ""); + static_assert(!std::is_unsigned::value, ""); + static_assert(!std::is_unsigned::value, ""); +} + +class Class +{ +public: + ~Class(); +}; + +int main() +{ + test_is_not_unsigned(); + test_is_not_unsigned(); + test_is_not_unsigned(); + test_is_not_unsigned(); + test_is_not_unsigned(); + test_is_not_unsigned(); + test_is_not_unsigned(); + test_is_not_unsigned(); + test_is_not_unsigned(); + + test_is_unsigned(); + test_is_unsigned(); + +#ifndef _LIBCPP_HAS_NO_INT128 + test_is_unsigned<__uint128_t>(); + test_is_not_unsigned<__int128_t>(); +#endif +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp new file mode 100644 index 00000000000..f6805bc1c4f --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// is_volatile + +#include + +template +void test_is_volatile() +{ + static_assert(!std::is_volatile::value, ""); + static_assert(!std::is_volatile::value, ""); + static_assert( std::is_volatile::value, ""); + static_assert( std::is_volatile::value, ""); +} + +int main() +{ + test_is_volatile(); + test_is_volatile(); + test_is_volatile(); + test_is_volatile(); + test_is_volatile(); + test_is_volatile(); + test_is_volatile(); + + static_assert(!std::is_volatile::value, ""); + static_assert(!std::is_volatile::value, ""); +} diff --git a/libcxx/test/std/utilities/meta/meta.unary/nothing_to_do.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/nothing_to_do.pass.cpp new file mode 100644 index 00000000000..b58f5c55b64 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/nothing_to_do.pass.cpp @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +int main() +{ +} diff --git a/libcxx/test/std/utilities/meta/version.pass.cpp b/libcxx/test/std/utilities/meta/version.pass.cpp new file mode 100644 index 00000000000..3a1033bbb56 --- /dev/null +++ b/libcxx/test/std/utilities/meta/version.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +#include + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} -- cgit v1.2.3