diff --git a/include/type_traits b/include/type_traits index a8afb9d9..8f1dd68d 100644 --- a/include/type_traits +++ b/include/type_traits @@ -203,8 +203,148 @@ namespace std using result_of_t = typename result_of::type; // C++14 template - using void_t = void; -} // C++17 + using void_t = void; // C++17 + + // See C++14 20.10.4.1, primary type categories + template constexpr bool is_void_v + = is_void::value; // C++17 + template constexpr bool is_null_pointer_v + = is_null_pointer::value; // C++17 + template constexpr bool is_integral_v + = is_integral::value; // C++17 + template constexpr bool is_floating_point_v + = is_floating_point::value; // C++17 + template constexpr bool is_array_v + = is_array::value; // C++17 + template constexpr bool is_pointer_v + = is_pointer::value; // C++17 + template constexpr bool is_lvalue_reference_v + = is_lvalue_reference::value; // C++17 + template constexpr bool is_rvalue_reference_v + = is_rvalue_reference::value; // C++17 + template constexpr bool is_member_object_pointer_v + = is_member_object_pointer::value; // C++17 + template constexpr bool is_member_function_pointer_v + = is_member_function_pointer::value; // C++17 + template constexpr bool is_enum_v + = is_enum::value; // C++17 + template constexpr bool is_union_v + = is_union::value; // C++17 + template constexpr bool is_class_v + = is_class::value; // C++17 + template constexpr bool is_function_v + = is_function::value; // C++17 + + // See C++14 20.10.4.2, composite type categories + template constexpr bool is_reference_v + = is_reference::value; // C++17 + template constexpr bool is_arithmetic_v + = is_arithmetic::value; // C++17 + template constexpr bool is_fundamental_v + = is_fundamental::value; // C++17 + template constexpr bool is_object_v + = is_object::value; // C++17 + template constexpr bool is_scalar_v + = is_scalar::value; // C++17 + template constexpr bool is_compound_v + = is_compound::value; // C++17 + template constexpr bool is_member_pointer_v + = is_member_pointer::value; // C++17 + + // See C++14 20.10.4.3, type properties + template constexpr bool is_const_v + = is_const::value; // C++17 + template constexpr bool is_volatile_v + = is_volatile::value; // C++17 + template constexpr bool is_trivial_v + = is_trivial::value; // C++17 + template constexpr bool is_trivially_copyable_v + = is_trivially_copyable::value; // C++17 + template constexpr bool is_standard_layout_v + = is_standard_layout::value; // C++17 + template constexpr bool is_pod_v + = is_pod::value; // C++17 + template constexpr bool is_literal_type_v + = is_literal_type::value; // C++17 + template constexpr bool is_empty_v + = is_empty::value; // C++17 + template constexpr bool is_polymorphic_v + = is_polymorphic::value; // C++17 + template constexpr bool is_abstract_v + = is_abstract::value; // C++17 + template constexpr bool is_final_v + = is_final::value; // C++17 + template constexpr bool is_signed_v + = is_signed::value; // C++17 + template constexpr bool is_unsigned_v + = is_unsigned::value; // C++17 + template constexpr bool is_constructible_v + = is_constructible::value; // C++17 + template constexpr bool is_default_constructible_v + = is_default_constructible::value; // C++17 + template constexpr bool is_copy_constructible_v + = is_copy_constructible::value; // C++17 + template constexpr bool is_move_constructible_v + = is_move_constructible::value; // C++17 + template constexpr bool is_assignable_v + = is_assignable::value; // C++17 + template constexpr bool is_copy_assignable_v + = is_copy_assignable::value; // C++17 + template constexpr bool is_move_assignable_v + = is_move_assignable::value; // C++17 + template constexpr bool is_destructible_v + = is_destructible::value; // C++17 + template constexpr bool is_trivially_constructible_v + = is_trivially_constructible::value; // C++17 + template constexpr bool is_trivially_default_constructible_v + = is_trivially_default_constructible::value; // C++17 + template constexpr bool is_trivially_copy_constructible_v + = is_trivially_copy_constructible::value; // C++17 + template constexpr bool is_trivially_move_constructible_v + = is_trivially_move_constructible::value; // C++17 + template constexpr bool is_trivially_assignable_v + = is_trivially_assignable::value; // C++17 + template constexpr bool is_trivially_copy_assignable_v + = is_trivially_copy_assignable::value; // C++17 + template constexpr bool is_trivially_move_assignable_v + = is_trivially_move_assignable::value; // C++17 + template constexpr bool is_trivially_destructible_v + = is_trivially_destructible::value; // C++17 + template constexpr bool is_nothrow_constructible_v + = is_nothrow_constructible::value; // C++17 + template constexpr bool is_nothrow_default_constructible_v + = is_nothrow_default_constructible::value; // C++17 + template constexpr bool is_nothrow_copy_constructible_v + = is_nothrow_copy_constructible::value; // C++17 + template constexpr bool is_nothrow_move_constructible_v + = is_nothrow_move_constructible::value; // C++17 + template constexpr bool is_nothrow_assignable_v + = is_nothrow_assignable::value; // C++17 + template constexpr bool is_nothrow_copy_assignable_v + = is_nothrow_copy_assignable::value; // C++17 + template constexpr bool is_nothrow_move_assignable_v + = is_nothrow_move_assignable::value; // C++17 + template constexpr bool is_nothrow_destructible_v + = is_nothrow_destructible::value; // C++17 + template constexpr bool has_virtual_destructor_v + = has_virtual_destructor::value; // C++17 + + // See C++14 20.10.5, type property queries + template constexpr size_t alignment_of_v + = alignment_of::value; // C++17 + template constexpr size_t rank_v + = rank::value; // C++17 + template constexpr size_t extent_v + = extent::value; // C++17 + + // See C++14 20.10.6, type relations + template constexpr bool is_same_v + = is_same::value; // C++17 + template constexpr bool is_base_of_v + = is_base_of::value; // C++17 + template constexpr bool is_convertible_v + = is_convertible::value; // C++17 +} */ #include <__config> @@ -329,11 +469,21 @@ struct __lazy_not : integral_constant {}; template struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {}; template struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_const_v + = is_const<_Tp>::value; +#endif + // is_volatile template struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {}; template struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_volatile_v + = is_volatile<_Tp>::value; +#endif + // remove_const template struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;}; @@ -366,6 +516,11 @@ template <> struct __libcpp_is_void : public true_type {}; template struct _LIBCPP_TYPE_VIS_ONLY is_void : public __libcpp_is_void::type> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_void_v + = is_void<_Tp>::value; +#endif + // __is_nullptr_t template struct __is_nullptr_t_impl : public false_type {}; @@ -377,6 +532,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t #if _LIBCPP_STD_VER > 11 template struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer : public __is_nullptr_t_impl::type> {}; + +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_null_pointer_v + = is_null_pointer<_Tp>::value; +#endif #endif // is_integral @@ -407,6 +567,11 @@ template <> struct __libcpp_is_integral<__uint128_t> : public tr template struct _LIBCPP_TYPE_VIS_ONLY is_integral : public __libcpp_is_integral::type> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_integral_v + = is_integral<_Tp>::value; +#endif + // is_floating_point template struct __libcpp_is_floating_point : public false_type {}; @@ -417,6 +582,11 @@ template <> struct __libcpp_is_floating_point : public tru template struct _LIBCPP_TYPE_VIS_ONLY is_floating_point : public __libcpp_is_floating_point::type> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_floating_point_v + = is_floating_point<_Tp>::value; +#endif + // is_array template struct _LIBCPP_TYPE_VIS_ONLY is_array @@ -426,6 +596,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]> template struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]> : public true_type {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_array_v + = is_array<_Tp>::value; +#endif + // is_pointer template struct __libcpp_is_pointer : public false_type {}; @@ -434,6 +609,11 @@ template struct __libcpp_is_pointer<_Tp*> : public true_type {}; template struct _LIBCPP_TYPE_VIS_ONLY is_pointer : public __libcpp_is_pointer::type> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_pointer_v + = is_pointer<_Tp>::value; +#endif + // is_reference template struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {}; @@ -450,6 +630,16 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public t template struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {}; #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_reference_v + = is_reference<_Tp>::value; + +template _LIBCPP_CONSTEXPR bool is_lvalue_reference_v + = is_lvalue_reference<_Tp>::value; + +template _LIBCPP_CONSTEXPR bool is_rvalue_reference_v + = is_rvalue_reference<_Tp>::value; +#endif // is_union #if __has_feature(is_union) || (_GNUC_VER >= 403) @@ -465,6 +655,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_union #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_union_v + = is_union<_Tp>::value; +#endif + // is_class #if __has_feature(is_class) || (_GNUC_VER >= 403) @@ -485,11 +680,21 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_class #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_class_v + = is_class<_Tp>::value; +#endif + // is_same template struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {}; template struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_same_v + = is_same<_Tp, _Up>::value; +#endif + // is_function namespace __libcpp_is_function_imp @@ -515,6 +720,11 @@ template struct __libcpp_is_function<_Tp, true> : public false_type template struct _LIBCPP_TYPE_VIS_ONLY is_function : public __libcpp_is_function<_Tp> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_function_v + = is_function<_Tp>::value; +#endif + // is_member_function_pointer // template struct __libcpp_is_member_function_pointer : public false_type {}; @@ -537,6 +747,11 @@ struct __libcpp_is_member_function_pointer<_Ret _Class::*> template struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer : public __libcpp_is_member_function_pointer::type>::type {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_member_function_pointer_v + = is_member_function_pointer<_Tp>::value; +#endif + // is_member_pointer template struct __libcpp_is_member_pointer : public false_type {}; @@ -545,12 +760,22 @@ template struct __libcpp_is_member_pointer<_Tp _Up::*> : template struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer : public __libcpp_is_member_pointer::type> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_member_pointer_v + = is_member_pointer<_Tp>::value; +#endif + // is_member_object_pointer template struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer : public integral_constant::value && !is_member_function_pointer<_Tp>::value> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_member_object_pointer_v + = is_member_object_pointer<_Tp>::value; +#endif + // is_enum #if __has_feature(is_enum) || (_GNUC_VER >= 403) @@ -574,12 +799,22 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_enum #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_enum_v + = is_enum<_Tp>::value; +#endif + // is_arithmetic template struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic : public integral_constant::value || is_floating_point<_Tp>::value> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_arithmetic_v + = is_arithmetic<_Tp>::value; +#endif + // is_fundamental template struct _LIBCPP_TYPE_VIS_ONLY is_fundamental @@ -587,6 +822,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_fundamental __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_fundamental_v + = is_fundamental<_Tp>::value; +#endif + // is_scalar template struct _LIBCPP_TYPE_VIS_ONLY is_scalar @@ -598,6 +838,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_scalar template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar : public true_type {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_scalar_v + = is_scalar<_Tp>::value; +#endif + // is_object template struct _LIBCPP_TYPE_VIS_ONLY is_object @@ -606,11 +851,21 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_object is_union<_Tp>::value || is_class<_Tp>::value > {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_object_v + = is_object<_Tp>::value; +#endif + // is_compound template struct _LIBCPP_TYPE_VIS_ONLY is_compound : public integral_constant::value> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_compound_v + = is_compound<_Tp>::value; +#endif + // add_const template ::value || @@ -748,6 +1003,11 @@ template struct __libcpp_is_signed<_Tp, false> : public false_type { template struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_signed_v + = is_signed<_Tp>::value; +#endif + // is_unsigned template ::value> @@ -763,6 +1023,11 @@ template struct __libcpp_is_unsigned<_Tp, false> : public false_type template struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_unsigned_v + = is_unsigned<_Tp>::value; +#endif + // rank template struct _LIBCPP_TYPE_VIS_ONLY rank @@ -851,6 +1116,11 @@ template struct __libcpp_abstract<_Tp, false> : public false_type {} template struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_abstract_v + = is_abstract<_Tp>::value; +#endif + // is_final #if defined(_LIBCPP_HAS_IS_FINAL) @@ -866,6 +1136,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_final : public integral_constant {}; #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_final_v + = is_final<_Tp>::value; +#endif + // is_base_of #ifdef _LIBCPP_HAS_IS_BASE_OF @@ -1059,6 +1334,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_emp #endif // __has_feature(is_empty) +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_empty_v + = is_empty<_Tp>::value; +#endif + // is_polymorphic #if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC) @@ -1079,6 +1359,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic #endif // __has_feature(is_polymorphic) +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_polymorphic_v + = is_polymorphic<_Tp>::value; +#endif + // has_virtual_destructor #if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) @@ -3323,6 +3608,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_pod #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_pod_v + = is_pod<_Tp>::value; +#endif + // is_literal_type; template struct _LIBCPP_TYPE_VIS_ONLY is_literal_type @@ -3334,6 +3624,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_literal_type #endif {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_literal_type_v + = is_literal_type<_Tp>::value; +#endif + // is_standard_layout; template struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout @@ -3344,6 +3639,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout #endif {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_standard_layout_v + = is_standard_layout<_Tp>::value; +#endif + // is_trivially_copyable; template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable @@ -3356,6 +3656,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable #endif {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_trivially_copyable_v + = is_trivially_copyable<_Tp>::value; +#endif + // is_trivial; template struct _LIBCPP_TYPE_VIS_ONLY is_trivial @@ -3367,6 +3672,11 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_trivial #endif {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_trivial_v + = is_trivial<_Tp>::value; +#endif + #ifndef _LIBCPP_HAS_NO_VARIADICS // Check for complete types diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.pass.cpp new file mode 100644 index 00000000..4bd072ef --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_array.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 + +// is_array + +#include +#include "test_macros.h" + +template +void test_is_array() +{ + static_assert( std::is_array::value, ""); + static_assert( std::is_array::value, ""); + static_assert( std::is_array::value, ""); + static_assert( std::is_array::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_array_v, ""); + static_assert( std::is_array_v, ""); + static_assert( std::is_array_v, ""); + static_assert( std::is_array_v, ""); +#endif +} + +template +void test_is_not_array() +{ + static_assert(!std::is_array::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_array::value, ""); + static_assert(!std::is_array::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_array_v, ""); + static_assert(!std::is_array_v, ""); + static_assert(!std::is_array_v, ""); + static_assert(!std::is_array_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_array(); + test_is_array(); + test_is_array(); + + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); + test_is_not_array(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp new file mode 100644 index 00000000..d720791f --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_class.pass.cpp @@ -0,0 +1,97 @@ +//===----------------------------------------------------------------------===// +// +// 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_class + +#include +#include "test_macros.h" + +template +void test_is_class() +{ + static_assert( std::is_class::value, ""); + static_assert( std::is_class::value, ""); + static_assert( std::is_class::value, ""); + static_assert( std::is_class::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_class_v, ""); + static_assert( std::is_class_v, ""); + static_assert( std::is_class_v, ""); + static_assert( std::is_class_v, ""); +#endif +} + +template +void test_is_not_class() +{ + static_assert(!std::is_class::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_class::value, ""); + static_assert(!std::is_class::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_class_v, ""); + static_assert(!std::is_class_v, ""); + static_assert(!std::is_class_v, ""); + static_assert(!std::is_class_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_class(); + test_is_class(); + test_is_class(); + test_is_class(); + +#if TEST_STD_VER >= 11 +// In C++03 we have an emulation of std::nullptr_t + test_is_not_class(); +#endif + test_is_not_class(); + test_is_not_class(); + test_is_not_class(); +#if TEST_STD_VER >= 11 + test_is_not_class(); +#endif + test_is_not_class(); + test_is_not_class(); + test_is_not_class(); + test_is_not_class(); + test_is_not_class(); + test_is_not_class(); + test_is_not_class(); + test_is_not_class(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.pass.cpp new file mode 100644 index 00000000..74db44f9 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_enum.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 + +// is_enum + +#include +#include "test_macros.h" + +template +void test_is_enum() +{ + static_assert( std::is_enum::value, ""); + static_assert( std::is_enum::value, ""); + static_assert( std::is_enum::value, ""); + static_assert( std::is_enum::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_enum_v, ""); + static_assert( std::is_enum_v, ""); + static_assert( std::is_enum_v, ""); + static_assert( std::is_enum_v, ""); +#endif +} + +template +void test_is_not_enum() +{ + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_enum::value, ""); + static_assert(!std::is_enum::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_enum_v, ""); + static_assert(!std::is_enum_v, ""); + static_assert(!std::is_enum_v, ""); + static_assert(!std::is_enum_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_enum(); + + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); + test_is_not_enum(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp new file mode 100644 index 00000000..6f6c1398 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_floating_point.pass.cpp @@ -0,0 +1,100 @@ +//===----------------------------------------------------------------------===// +// +// 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_floating_point + +#include +#include "test_macros.h" + +template +void test_is_floating_point() +{ + static_assert( std::is_floating_point::value, ""); + static_assert( std::is_floating_point::value, ""); + static_assert( std::is_floating_point::value, ""); + static_assert( std::is_floating_point::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_floating_point_v, ""); + static_assert( std::is_floating_point_v, ""); + static_assert( std::is_floating_point_v, ""); + static_assert( std::is_floating_point_v, ""); +#endif +} + +template +void test_is_not_floating_point() +{ + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_floating_point::value, ""); + static_assert(!std::is_floating_point::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_floating_point_v, ""); + static_assert(!std::is_floating_point_v, ""); + static_assert(!std::is_floating_point_v, ""); + static_assert(!std::is_floating_point_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_floating_point(); + test_is_floating_point(); + test_is_floating_point(); + + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); + test_is_not_floating_point(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp new file mode 100644 index 00000000..387fa0b4 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_function.pass.cpp @@ -0,0 +1,97 @@ +//===----------------------------------------------------------------------===// +// +// 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_function + +#include +#include "test_macros.h" + +template +void test_is_function() +{ + static_assert( std::is_function::value, ""); + static_assert( std::is_function::value, ""); + static_assert( std::is_function::value, ""); + static_assert( std::is_function::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_function_v, ""); + static_assert( std::is_function_v, ""); + static_assert( std::is_function_v, ""); + static_assert( std::is_function_v, ""); +#endif +} + +template +void test_is_not_function() +{ + static_assert(!std::is_function::value, ""); + static_assert(!std::is_function::value, ""); + static_assert(!std::is_function::value, ""); + static_assert(!std::is_function::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_function_v, ""); + static_assert(!std::is_function_v, ""); + static_assert(!std::is_function_v, ""); + static_assert(!std::is_function_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_function(); + test_is_function(); + test_is_function(); + test_is_function(); + test_is_function(); + + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); // function pointer is not a function + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); + test_is_not_function(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.pass.cpp new file mode 100644 index 00000000..a10e1685 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_integral.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 + +// is_integral + +#include +#include "test_macros.h" + +template +void test_is_integral() +{ + static_assert( std::is_integral::value, ""); + static_assert( std::is_integral::value, ""); + static_assert( std::is_integral::value, ""); + static_assert( std::is_integral::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_integral_v, ""); + static_assert( std::is_integral_v, ""); + static_assert( std::is_integral_v, ""); + static_assert( std::is_integral_v, ""); +#endif +} + +template +void test_is_not_integral() +{ + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_integral::value, ""); + static_assert(!std::is_integral::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_integral_v, ""); + static_assert(!std::is_integral_v, ""); + static_assert(!std::is_integral_v, ""); + static_assert(!std::is_integral_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + test_is_integral(); + + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); + test_is_not_integral(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp new file mode 100644 index 00000000..1df9e340 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp @@ -0,0 +1,94 @@ +//===----------------------------------------------------------------------===// +// +// 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_lvalue_reference + +// UNSUPPORTED: c++98, c++03 + +#include +#include "test_macros.h" + +template +void test_is_lvalue_reference() +{ + static_assert( std::is_lvalue_reference::value, ""); + static_assert( std::is_lvalue_reference::value, ""); + static_assert( std::is_lvalue_reference::value, ""); + static_assert( std::is_lvalue_reference::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_lvalue_reference_v, ""); + static_assert( std::is_lvalue_reference_v, ""); + static_assert( std::is_lvalue_reference_v, ""); + static_assert( std::is_lvalue_reference_v, ""); +#endif +} + +template +void test_is_not_lvalue_reference() +{ + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); + static_assert(!std::is_lvalue_reference::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_lvalue_reference_v, ""); + static_assert(!std::is_lvalue_reference_v, ""); + static_assert(!std::is_lvalue_reference_v, ""); + static_assert(!std::is_lvalue_reference_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_lvalue_reference(); + + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); + test_is_not_lvalue_reference(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp new file mode 100644 index 00000000..4ca857b3 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_object_pointer.pass.cpp @@ -0,0 +1,96 @@ +//===----------------------------------------------------------------------===// +// +// 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_member_object_pointer + +#include +#include "test_macros.h" + +template +void test_is_member_object_pointer() +{ + static_assert( std::is_member_object_pointer::value, ""); + static_assert( std::is_member_object_pointer::value, ""); + static_assert( std::is_member_object_pointer::value, ""); + static_assert( std::is_member_object_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_member_object_pointer_v, ""); + static_assert( std::is_member_object_pointer_v, ""); + static_assert( std::is_member_object_pointer_v, ""); + static_assert( std::is_member_object_pointer_v, ""); +#endif +} + +template +void test_is_not_member_object_pointer() +{ + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); + static_assert(!std::is_member_object_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_member_object_pointer_v, ""); + static_assert(!std::is_member_object_pointer_v, ""); + static_assert(!std::is_member_object_pointer_v, ""); + static_assert(!std::is_member_object_pointer_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ + test_is_member_object_pointer(); + test_is_member_object_pointer(); + test_is_member_object_pointer(); + + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); + test_is_not_member_object_pointer(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp new file mode 100644 index 00000000..f2bb3cbd --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_member_pointer.pass.cpp @@ -0,0 +1,97 @@ +//===----------------------------------------------------------------------===// +// +// 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_member_pointer + +#include +#include "test_macros.h" + +template +void test_is_member_pointer() +{ + static_assert( std::is_member_pointer::value, ""); + static_assert( std::is_member_pointer::value, ""); + static_assert( std::is_member_pointer::value, ""); + static_assert( std::is_member_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_member_pointer_v, ""); + static_assert( std::is_member_pointer_v, ""); + static_assert( std::is_member_pointer_v, ""); + static_assert( std::is_member_pointer_v, ""); +#endif +} + +template +void test_is_not_member_pointer() +{ + static_assert(!std::is_member_pointer::value, ""); + static_assert(!std::is_member_pointer::value, ""); + static_assert(!std::is_member_pointer::value, ""); + static_assert(!std::is_member_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_member_pointer_v, ""); + static_assert(!std::is_member_pointer_v, ""); + static_assert(!std::is_member_pointer_v, ""); + static_assert(!std::is_member_pointer_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ + test_is_member_pointer(); + test_is_member_pointer(); + test_is_member_pointer(); + test_is_member_pointer(); + + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp new file mode 100644 index 00000000..20efdd56 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_null_pointer.pass.cpp @@ -0,0 +1,94 @@ +//===----------------------------------------------------------------------===// +// +// 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_null_pointer + +// UNSUPPORTED: c++98, c++03, c++11 + +#include +#include "test_macros.h" + +template +void test_is_null_pointer() +{ + static_assert( std::is_null_pointer::value, ""); + static_assert( std::is_null_pointer::value, ""); + static_assert( std::is_null_pointer::value, ""); + static_assert( std::is_null_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_null_pointer_v, ""); + static_assert( std::is_null_pointer_v, ""); + static_assert( std::is_null_pointer_v, ""); + static_assert( std::is_null_pointer_v, ""); +#endif +} + +template +void test_is_not_null_pointer() +{ + static_assert(!std::is_null_pointer::value, ""); + static_assert(!std::is_null_pointer::value, ""); + static_assert(!std::is_null_pointer::value, ""); + static_assert(!std::is_null_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_null_pointer_v, ""); + static_assert(!std::is_null_pointer_v, ""); + static_assert(!std::is_null_pointer_v, ""); + static_assert(!std::is_null_pointer_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_null_pointer(); + + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); + test_is_not_null_pointer(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.pass.cpp new file mode 100644 index 00000000..c1bef593 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_pointer.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_pointer + +#include +#include "test_macros.h" + +template +void test_is_pointer() +{ + static_assert( std::is_pointer::value, ""); + static_assert( std::is_pointer::value, ""); + static_assert( std::is_pointer::value, ""); + static_assert( std::is_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_pointer_v, ""); + static_assert( std::is_pointer_v, ""); + static_assert( std::is_pointer_v, ""); + static_assert( std::is_pointer_v, ""); +#endif +} + +template +void test_is_not_pointer() +{ + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_pointer::value, ""); + static_assert(!std::is_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_pointer_v, ""); + static_assert(!std::is_pointer_v, ""); + static_assert(!std::is_pointer_v, ""); + static_assert(!std::is_pointer_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + test_is_pointer(); + + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); + test_is_not_pointer(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp new file mode 100644 index 00000000..9c01d348 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp @@ -0,0 +1,94 @@ +//===----------------------------------------------------------------------===// +// +// 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_rvalue_reference + +// UNSUPPORTED: c++98, c++03 + +#include +#include "test_macros.h" + +template +void test_is_rvalue_reference() +{ + static_assert( std::is_rvalue_reference::value, ""); + static_assert( std::is_rvalue_reference::value, ""); + static_assert( std::is_rvalue_reference::value, ""); + static_assert( std::is_rvalue_reference::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_rvalue_reference_v, ""); + static_assert( std::is_rvalue_reference_v, ""); + static_assert( std::is_rvalue_reference_v, ""); + static_assert( std::is_rvalue_reference_v, ""); +#endif +} + +template +void test_is_not_rvalue_reference() +{ + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); + static_assert(!std::is_rvalue_reference::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_rvalue_reference_v, ""); + static_assert(!std::is_rvalue_reference_v, ""); + static_assert(!std::is_rvalue_reference_v, ""); + static_assert(!std::is_rvalue_reference_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_rvalue_reference(); + + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); + test_is_not_rvalue_reference(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_union.pass.cpp new file mode 100644 index 00000000..65c8d793 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_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 + +// is_union + +#include +#include "test_macros.h" + +template +void test_is_union() +{ + static_assert( std::is_union::value, ""); + static_assert( std::is_union::value, ""); + static_assert( std::is_union::value, ""); + static_assert( std::is_union::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_union_v, ""); + static_assert( std::is_union_v, ""); + static_assert( std::is_union_v, ""); + static_assert( std::is_union_v, ""); +#endif +} + +template +void test_is_not_union() +{ + static_assert(!std::is_union::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_union::value, ""); + static_assert(!std::is_union::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_union_v, ""); + static_assert(!std::is_union_v, ""); + static_assert(!std::is_union_v, ""); + static_assert(!std::is_union_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_union(); + + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); + test_is_not_union(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.pass.cpp new file mode 100644 index 00000000..f25f966a --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.cat/is_void.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_void + +#include +#include "test_macros.h" + +template +void test_is_void() +{ + static_assert( std::is_void::value, ""); + static_assert( std::is_void::value, ""); + static_assert( std::is_void::value, ""); + static_assert( std::is_void::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_void_v, ""); + static_assert( std::is_void_v, ""); + static_assert( std::is_void_v, ""); + static_assert( std::is_void_v, ""); +#endif +} + +template +void test_is_not_void() +{ + static_assert(!std::is_void::value, ""); + static_assert(!std::is_void::value, ""); + static_assert(!std::is_void::value, ""); + static_assert(!std::is_void::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_void_v, ""); + static_assert(!std::is_void_v, ""); + static_assert(!std::is_void_v, ""); + static_assert(!std::is_void_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + +int main() +{ + test_is_void(); + + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); + test_is_not_void(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.pass.cpp new file mode 100644 index 00000000..dba2a084 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_arithmetic.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 + +// is_arithmetic + +#include +#include "test_macros.h" + +template +void test_is_arithmetic() +{ + static_assert( std::is_arithmetic::value, ""); + static_assert( std::is_arithmetic::value, ""); + static_assert( std::is_arithmetic::value, ""); + static_assert( std::is_arithmetic::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_arithmetic_v, ""); + static_assert( std::is_arithmetic_v, ""); + static_assert( std::is_arithmetic_v, ""); + static_assert( std::is_arithmetic_v, ""); +#endif +} + +template +void test_is_not_arithmetic() +{ + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_arithmetic::value, ""); + static_assert(!std::is_arithmetic::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_arithmetic_v, ""); + static_assert(!std::is_arithmetic_v, ""); + static_assert(!std::is_arithmetic_v, ""); + static_assert(!std::is_arithmetic_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + test_is_arithmetic(); + + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); + test_is_not_arithmetic(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp new file mode 100644 index 00000000..e34a930e --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_compound.pass.cpp @@ -0,0 +1,94 @@ +//===----------------------------------------------------------------------===// +// +// 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_compound + +#include +#include "test_macros.h" + +template +void test_is_compound() +{ + static_assert( std::is_compound::value, ""); + static_assert( std::is_compound::value, ""); + static_assert( std::is_compound::value, ""); + static_assert( std::is_compound::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_compound_v, ""); + static_assert( std::is_compound_v, ""); + static_assert( std::is_compound_v, ""); + static_assert( std::is_compound_v, ""); +#endif +} + +template +void test_is_not_compound() +{ + static_assert(!std::is_compound::value, ""); + static_assert(!std::is_compound::value, ""); + static_assert(!std::is_compound::value, ""); + static_assert(!std::is_compound::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_compound_v, ""); + static_assert(!std::is_compound_v, ""); + static_assert(!std::is_compound_v, ""); + static_assert(!std::is_compound_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + test_is_compound(); + + test_is_not_compound(); + test_is_not_compound(); + test_is_not_compound(); + test_is_not_compound(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp new file mode 100644 index 00000000..82a49f88 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_fundamental.pass.cpp @@ -0,0 +1,111 @@ +//===----------------------------------------------------------------------===// +// +// 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_fundamental + +#include +#include "test_macros.h" + +template +void test_is_fundamental() +{ + static_assert( std::is_fundamental::value, ""); + static_assert( std::is_fundamental::value, ""); + static_assert( std::is_fundamental::value, ""); + static_assert( std::is_fundamental::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_fundamental_v, ""); + static_assert( std::is_fundamental_v, ""); + static_assert( std::is_fundamental_v, ""); + static_assert( std::is_fundamental_v, ""); +#endif +} + +template +void test_is_not_fundamental() +{ + static_assert(!std::is_fundamental::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert(!std::is_fundamental::value, ""); + static_assert(!std::is_fundamental::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_fundamental_v, ""); + static_assert(!std::is_fundamental_v, ""); + static_assert(!std::is_fundamental_v, ""); + static_assert(!std::is_fundamental_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + test_is_fundamental(); + + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); + test_is_not_fundamental(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp new file mode 100644 index 00000000..ce34cb6a --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_member_pointer.pass.cpp @@ -0,0 +1,101 @@ +//===----------------------------------------------------------------------===// +// +// 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_member_pointer + +#include +#include "test_macros.h" + +template +void test_is_member_pointer() +{ + static_assert( std::is_member_pointer::value, ""); + static_assert( std::is_member_pointer::value, ""); + static_assert( std::is_member_pointer::value, ""); + static_assert( std::is_member_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_member_pointer_v, ""); + static_assert( std::is_member_pointer_v, ""); + static_assert( std::is_member_pointer_v, ""); + static_assert( std::is_member_pointer_v, ""); +#endif +} + +template +void test_is_not_member_pointer() +{ + static_assert(!std::is_member_pointer::value, ""); + static_assert(!std::is_member_pointer::value, ""); + static_assert(!std::is_member_pointer::value, ""); + static_assert(!std::is_member_pointer::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_member_pointer_v, ""); + static_assert(!std::is_member_pointer_v, ""); + static_assert(!std::is_member_pointer_v, ""); + static_assert(!std::is_member_pointer_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ +// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2), +// std::nullptr_t, and cv-qualified versions of these types (3.9.3) +// are collectively called scalar types. + + test_is_member_pointer(); + test_is_member_pointer(); + + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); + test_is_not_member_pointer(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp new file mode 100644 index 00000000..3961a855 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_object.pass.cpp @@ -0,0 +1,100 @@ +//===----------------------------------------------------------------------===// +// +// 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_object + +#include +#include "test_macros.h" + +template +void test_is_object() +{ + static_assert( std::is_object::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_object::value, ""); + static_assert( std::is_object::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_object_v, ""); + static_assert( std::is_object_v, ""); + static_assert( std::is_object_v, ""); + static_assert( std::is_object_v, ""); +#endif +} + +template +void test_is_not_object() +{ + static_assert(!std::is_object::value, ""); + static_assert(!std::is_object::value, ""); + static_assert(!std::is_object::value, ""); + static_assert(!std::is_object::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_object_v, ""); + static_assert(!std::is_object_v, ""); + static_assert(!std::is_object_v, ""); + static_assert(!std::is_object_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ +// An object type is a (possibly cv-qualified) type that is not a function type, +// not a reference type, and not a void type. + + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + test_is_object(); + + test_is_not_object(); + test_is_not_object(); + test_is_not_object(); + test_is_not_object(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp new file mode 100644 index 00000000..b3ce034a --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp @@ -0,0 +1,100 @@ +//===----------------------------------------------------------------------===// +// +// 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_reference + +#include +#include "test_macros.h" + +template +void test_is_reference() +{ + static_assert( std::is_reference::value, ""); + static_assert( std::is_reference::value, ""); + static_assert( std::is_reference::value, ""); + static_assert( std::is_reference::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_reference_v, ""); + static_assert( std::is_reference_v, ""); + static_assert( std::is_reference_v, ""); + static_assert( std::is_reference_v, ""); +#endif +} + +template +void test_is_not_reference() +{ + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_reference::value, ""); + static_assert(!std::is_reference::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_reference_v, ""); + static_assert(!std::is_reference_v, ""); + static_assert(!std::is_reference_v, ""); + static_assert(!std::is_reference_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ + test_is_reference(); +#if TEST_STD_VER >= 11 + test_is_reference(); +#endif + + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + test_is_not_reference(); + +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp new file mode 100644 index 00000000..9738c297 --- /dev/null +++ b/test/std/utilities/meta/meta.unary/meta.unary.comp/is_scalar.pass.cpp @@ -0,0 +1,110 @@ +//===----------------------------------------------------------------------===// +// +// 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_scalar + +#include +#include "test_macros.h" + +template +void test_is_scalar() +{ + static_assert( std::is_scalar::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert( std::is_scalar::value, ""); + static_assert( std::is_scalar::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_scalar_v, ""); + static_assert( std::is_scalar_v, ""); + static_assert( std::is_scalar_v, ""); + static_assert( std::is_scalar_v, ""); +#endif +} + +template +void test_is_not_scalar() +{ + static_assert(!std::is_scalar::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert(!std::is_scalar::value, ""); + static_assert(!std::is_scalar::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_scalar_v, ""); + static_assert(!std::is_scalar_v, ""); + static_assert(!std::is_scalar_v, ""); + static_assert(!std::is_scalar_v, ""); +#endif +} + +class Empty +{ +}; + +class NotEmpty +{ + virtual ~NotEmpty(); +}; + +union Union {}; + +struct bit_zero +{ + int : 0; +}; + +class Abstract +{ + virtual ~Abstract() = 0; +}; + +enum Enum {zero, one}; + +typedef void (*FunctionPtr)(); + + +int main() +{ +// Arithmetic types (3.9.1), enumeration types, pointer types, pointer to member types (3.9.2), +// std::nullptr_t, and cv-qualified versions of these types (3.9.3) +// are collectively called scalar types. + + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + test_is_scalar(); + + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); + test_is_not_scalar(); +} diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp index f2a8c232..a54adf10 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_abstract.pass.cpp @@ -12,6 +12,7 @@ // is_abstract #include +#include "test_macros.h" template void test_is_abstract() @@ -20,6 +21,12 @@ void test_is_abstract() static_assert( std::is_abstract::value, ""); static_assert( std::is_abstract::value, ""); static_assert( std::is_abstract::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_abstract_v, ""); + static_assert( std::is_abstract_v, ""); + static_assert( std::is_abstract_v, ""); + static_assert( std::is_abstract_v, ""); +#endif } template @@ -29,6 +36,12 @@ void test_is_not_abstract() static_assert(!std::is_abstract::value, ""); static_assert(!std::is_abstract::value, ""); static_assert(!std::is_abstract::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_abstract_v, ""); + static_assert(!std::is_abstract_v, ""); + static_assert(!std::is_abstract_v, ""); + static_assert(!std::is_abstract_v, ""); +#endif } class Empty diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp index 72f2ff45..19d43376 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_const.pass.cpp @@ -20,6 +20,12 @@ void test_is_const() static_assert( std::is_const::value, ""); static_assert(!std::is_const::value, ""); static_assert( std::is_const::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_const_v::value, ""); + static_assert( std::is_const_v, ""); + static_assert(!std::is_const_v, ""); + static_assert( std::is_const_v, ""); +#endif } int main() diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp index 47af3c45..f9e13d26 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_empty.pass.cpp @@ -20,6 +20,12 @@ void test_is_empty() static_assert( std::is_empty::value, ""); static_assert( std::is_empty::value, ""); static_assert( std::is_empty::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_empty_v, ""); + static_assert( std::is_empty_v, ""); + static_assert( std::is_empty_v, ""); + static_assert( std::is_empty_v, ""); +#endif } template @@ -29,6 +35,12 @@ void test_is_not_empty() static_assert(!std::is_empty::value, ""); static_assert(!std::is_empty::value, ""); static_assert(!std::is_empty::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_empty_v, ""); + static_assert(!std::is_empty_v, ""); + static_assert(!std::is_empty_v, ""); + static_assert(!std::is_empty_v, ""); +#endif } class Empty diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp index cf321962..c2023bc0 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_final.pass.cpp @@ -26,6 +26,12 @@ void test_is_final() static_assert( std::is_final::value, ""); static_assert( std::is_final::value, ""); static_assert( std::is_final::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_final_v, ""); + static_assert( std::is_final_v, ""); + static_assert( std::is_final_v, ""); + static_assert( std::is_final_v, ""); +#endif } template @@ -35,6 +41,12 @@ void test_is_not_final() static_assert(!std::is_final::value, ""); static_assert(!std::is_final::value, ""); static_assert(!std::is_final::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_final_v, ""); + static_assert(!std::is_final_v, ""); + static_assert(!std::is_final_v, ""); + static_assert(!std::is_final_v, ""); +#endif } int main () diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp index ce781cd9..174521d0 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp @@ -17,12 +17,26 @@ template void test_is_literal_type() { static_assert( std::is_literal_type::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_literal_type_v, ""); +// static_assert( std::is_final_v, ""); +// static_assert( std::is_final_v, ""); +// static_assert( std::is_final_v, ""); +// static_assert( std::is_final_v, ""); +#endif } template void test_is_not_literal_type() { static_assert(!std::is_literal_type::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_literal_type_v, ""); +// static_assert( std::is_final_v, ""); +// static_assert( std::is_final_v, ""); +// static_assert( std::is_final_v, ""); +// static_assert( std::is_final_v, ""); +#endif } struct A diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp index 4ec1ae99..1042cae5 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_pod.pass.cpp @@ -20,6 +20,12 @@ void test_is_pod() static_assert( std::is_pod::value, ""); static_assert( std::is_pod::value, ""); static_assert( std::is_pod::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_pod_v, ""); + static_assert( std::is_pod_v, ""); + static_assert( std::is_pod_v, ""); + static_assert( std::is_pod_v, ""); +#endif } template @@ -29,6 +35,12 @@ void test_is_not_pod() static_assert(!std::is_pod::value, ""); static_assert(!std::is_pod::value, ""); static_assert(!std::is_pod::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_pod_v, ""); + static_assert( std::is_pod_v, ""); + static_assert( std::is_pod_v, ""); + static_assert( std::is_pod_v, ""); +#endif } class Class diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp index 6e82cddc..26c1fd10 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp @@ -20,6 +20,12 @@ void test_is_polymorphic() static_assert( std::is_polymorphic::value, ""); static_assert( std::is_polymorphic::value, ""); static_assert( std::is_polymorphic::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_polymorphic_v, ""); + static_assert( std::is_polymorphic_v, ""); + static_assert( std::is_polymorphic_v, ""); + static_assert( std::is_polymorphic_v, ""); +#endif } template @@ -29,6 +35,12 @@ void test_is_not_polymorphic() static_assert(!std::is_polymorphic::value, ""); static_assert(!std::is_polymorphic::value, ""); static_assert(!std::is_polymorphic::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_polymorphic_v, ""); + static_assert(!std::is_polymorphic_v, ""); + static_assert(!std::is_polymorphic_v, ""); + static_assert(!std::is_polymorphic_v, ""); +#endif } class Empty diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp index 479c2529..ea280940 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_signed.pass.cpp @@ -20,6 +20,12 @@ void test_is_signed() static_assert( std::is_signed::value, ""); static_assert( std::is_signed::value, ""); static_assert( std::is_signed::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_signed_v, ""); + static_assert( std::is_signed_v, ""); + static_assert( std::is_signed_v, ""); + static_assert( std::is_signed_v, ""); +#endif } template @@ -29,6 +35,12 @@ void test_is_not_signed() static_assert(!std::is_signed::value, ""); static_assert(!std::is_signed::value, ""); static_assert(!std::is_signed::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_signed_v, ""); + static_assert(!std::is_signed_v, ""); + static_assert(!std::is_signed_v, ""); + static_assert(!std::is_signed_v, ""); +#endif } class Class diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp index 668c4cdc..1bb80532 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_standard_layout.pass.cpp @@ -20,6 +20,12 @@ 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, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_standard_layout_v, ""); + static_assert( std::is_standard_layout_v, ""); + static_assert( std::is_standard_layout_v, ""); + static_assert( std::is_standard_layout_v, ""); +#endif } template @@ -29,6 +35,12 @@ 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, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_standard_layout_v, ""); + static_assert(!std::is_standard_layout_v, ""); + static_assert(!std::is_standard_layout_v, ""); + static_assert(!std::is_standard_layout_v, ""); +#endif } template diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp index af38699d..ccc226a5 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivial.pass.cpp @@ -20,6 +20,12 @@ void test_is_trivial() static_assert( std::is_trivial::value, ""); static_assert( std::is_trivial::value, ""); static_assert( std::is_trivial::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_trivial_v, ""); + static_assert( std::is_trivial_v, ""); + static_assert( std::is_trivial_v, ""); + static_assert( std::is_trivial_v, ""); +#endif } template @@ -29,6 +35,12 @@ void test_is_not_trivial() static_assert(!std::is_trivial::value, ""); static_assert(!std::is_trivial::value, ""); static_assert(!std::is_trivial::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_trivial_v, ""); + static_assert(!std::is_trivial_v, ""); + static_assert(!std::is_trivial_v, ""); + static_assert(!std::is_trivial_v, ""); +#endif } struct A {}; diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp index d6588237..9b935d1d 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copyable.pass.cpp @@ -21,6 +21,12 @@ 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, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_trivially_copyable_v, ""); + static_assert( std::is_trivially_copyable_v, ""); + static_assert(!std::is_trivially_copyable_v, ""); + static_assert(!std::is_trivially_copyable_v, ""); +#endif } template @@ -30,6 +36,12 @@ 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, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_trivially_copyable_v, ""); + static_assert(!std::is_trivially_copyable_v, ""); + static_assert(!std::is_trivially_copyable_v, ""); + static_assert(!std::is_trivially_copyable_v, ""); +#endif } struct A diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp index dfdb1554..74481092 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_unsigned.pass.cpp @@ -20,6 +20,12 @@ void test_is_unsigned() static_assert( std::is_unsigned::value, ""); static_assert( std::is_unsigned::value, ""); static_assert( std::is_unsigned::value, ""); +#if TEST_STD_VER > 14 + static_assert( std::is_unsigned_v, ""); + static_assert( std::is_unsigned_v, ""); + static_assert( std::is_unsigned_v, ""); + static_assert( std::is_unsigned_v, ""); +#endif } template @@ -29,6 +35,12 @@ void test_is_not_unsigned() static_assert(!std::is_unsigned::value, ""); static_assert(!std::is_unsigned::value, ""); static_assert(!std::is_unsigned::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_unsigned_v, ""); + static_assert(!std::is_unsigned_v, ""); + static_assert(!std::is_unsigned_v, ""); + static_assert(!std::is_unsigned_v, ""); +#endif } class Class diff --git a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp index f6805bc1..152b04f4 100644 --- a/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp +++ b/test/std/utilities/meta/meta.unary/meta.unary.prop/is_volatile.pass.cpp @@ -20,6 +20,12 @@ void test_is_volatile() static_assert(!std::is_volatile::value, ""); static_assert( std::is_volatile::value, ""); static_assert( std::is_volatile::value, ""); +#if TEST_STD_VER > 14 + static_assert(!std::is_volatile_v, ""); + static_assert(!std::is_volatile_v, ""); + static_assert( std::is_volatile_v, ""); + static_assert( std::is_volatile_v, ""); +#endif } int main()