Implement the first part of P0006R0: Adopt Type Traits Variable Templates for C++17. Significantly augment the existing tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@251766 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2015-11-01 20:24:59 +00:00
parent 9d6ca4962b
commit 94611a888b
35 changed files with 2510 additions and 2 deletions

View File

@ -203,8 +203,148 @@ namespace std
using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14 using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14
template <class...> template <class...>
using void_t = void; using void_t = void; // C++17
} // C++17
// See C++14 20.10.4.1, primary type categories
template <class T> constexpr bool is_void_v
= is_void<T>::value; // C++17
template <class T> constexpr bool is_null_pointer_v
= is_null_pointer<T>::value; // C++17
template <class T> constexpr bool is_integral_v
= is_integral<T>::value; // C++17
template <class T> constexpr bool is_floating_point_v
= is_floating_point<T>::value; // C++17
template <class T> constexpr bool is_array_v
= is_array<T>::value; // C++17
template <class T> constexpr bool is_pointer_v
= is_pointer<T>::value; // C++17
template <class T> constexpr bool is_lvalue_reference_v
= is_lvalue_reference<T>::value; // C++17
template <class T> constexpr bool is_rvalue_reference_v
= is_rvalue_reference<T>::value; // C++17
template <class T> constexpr bool is_member_object_pointer_v
= is_member_object_pointer<T>::value; // C++17
template <class T> constexpr bool is_member_function_pointer_v
= is_member_function_pointer<T>::value; // C++17
template <class T> constexpr bool is_enum_v
= is_enum<T>::value; // C++17
template <class T> constexpr bool is_union_v
= is_union<T>::value; // C++17
template <class T> constexpr bool is_class_v
= is_class<T>::value; // C++17
template <class T> constexpr bool is_function_v
= is_function<T>::value; // C++17
// See C++14 20.10.4.2, composite type categories
template <class T> constexpr bool is_reference_v
= is_reference<T>::value; // C++17
template <class T> constexpr bool is_arithmetic_v
= is_arithmetic<T>::value; // C++17
template <class T> constexpr bool is_fundamental_v
= is_fundamental<T>::value; // C++17
template <class T> constexpr bool is_object_v
= is_object<T>::value; // C++17
template <class T> constexpr bool is_scalar_v
= is_scalar<T>::value; // C++17
template <class T> constexpr bool is_compound_v
= is_compound<T>::value; // C++17
template <class T> constexpr bool is_member_pointer_v
= is_member_pointer<T>::value; // C++17
// See C++14 20.10.4.3, type properties
template <class T> constexpr bool is_const_v
= is_const<T>::value; // C++17
template <class T> constexpr bool is_volatile_v
= is_volatile<T>::value; // C++17
template <class T> constexpr bool is_trivial_v
= is_trivial<T>::value; // C++17
template <class T> constexpr bool is_trivially_copyable_v
= is_trivially_copyable<T>::value; // C++17
template <class T> constexpr bool is_standard_layout_v
= is_standard_layout<T>::value; // C++17
template <class T> constexpr bool is_pod_v
= is_pod<T>::value; // C++17
template <class T> constexpr bool is_literal_type_v
= is_literal_type<T>::value; // C++17
template <class T> constexpr bool is_empty_v
= is_empty<T>::value; // C++17
template <class T> constexpr bool is_polymorphic_v
= is_polymorphic<T>::value; // C++17
template <class T> constexpr bool is_abstract_v
= is_abstract<T>::value; // C++17
template <class T> constexpr bool is_final_v
= is_final<T>::value; // C++17
template <class T> constexpr bool is_signed_v
= is_signed<T>::value; // C++17
template <class T> constexpr bool is_unsigned_v
= is_unsigned<T>::value; // C++17
template <class T, class... Args> constexpr bool is_constructible_v
= is_constructible<T, Args...>::value; // C++17
template <class T> constexpr bool is_default_constructible_v
= is_default_constructible<T>::value; // C++17
template <class T> constexpr bool is_copy_constructible_v
= is_copy_constructible<T>::value; // C++17
template <class T> constexpr bool is_move_constructible_v
= is_move_constructible<T>::value; // C++17
template <class T, class U> constexpr bool is_assignable_v
= is_assignable<T, U>::value; // C++17
template <class T> constexpr bool is_copy_assignable_v
= is_copy_assignable<T>::value; // C++17
template <class T> constexpr bool is_move_assignable_v
= is_move_assignable<T>::value; // C++17
template <class T> constexpr bool is_destructible_v
= is_destructible<T>::value; // C++17
template <class T, class... Args> constexpr bool is_trivially_constructible_v
= is_trivially_constructible<T, Args...>::value; // C++17
template <class T> constexpr bool is_trivially_default_constructible_v
= is_trivially_default_constructible<T>::value; // C++17
template <class T> constexpr bool is_trivially_copy_constructible_v
= is_trivially_copy_constructible<T>::value; // C++17
template <class T> constexpr bool is_trivially_move_constructible_v
= is_trivially_move_constructible<T>::value; // C++17
template <class T, class U> constexpr bool is_trivially_assignable_v
= is_trivially_assignable<T, U>::value; // C++17
template <class T> constexpr bool is_trivially_copy_assignable_v
= is_trivially_copy_assignable<T>::value; // C++17
template <class T> constexpr bool is_trivially_move_assignable_v
= is_trivially_move_assignable<T>::value; // C++17
template <class T> constexpr bool is_trivially_destructible_v
= is_trivially_destructible<T>::value; // C++17
template <class T, class... Args> constexpr bool is_nothrow_constructible_v
= is_nothrow_constructible<T, Args...>::value; // C++17
template <class T> constexpr bool is_nothrow_default_constructible_v
= is_nothrow_default_constructible<T>::value; // C++17
template <class T> constexpr bool is_nothrow_copy_constructible_v
= is_nothrow_copy_constructible<T>::value; // C++17
template <class T> constexpr bool is_nothrow_move_constructible_v
= is_nothrow_move_constructible<T>::value; // C++17
template <class T, class U> constexpr bool is_nothrow_assignable_v
= is_nothrow_assignable<T, U>::value; // C++17
template <class T> constexpr bool is_nothrow_copy_assignable_v
= is_nothrow_copy_assignable<T>::value; // C++17
template <class T> constexpr bool is_nothrow_move_assignable_v
= is_nothrow_move_assignable<T>::value; // C++17
template <class T> constexpr bool is_nothrow_destructible_v
= is_nothrow_destructible<T>::value; // C++17
template <class T> constexpr bool has_virtual_destructor_v
= has_virtual_destructor<T>::value; // C++17
// See C++14 20.10.5, type property queries
template <class T> constexpr size_t alignment_of_v
= alignment_of<T>::value; // C++17
template <class T> constexpr size_t rank_v
= rank<T>::value; // C++17
template <class T, unsigned I = 0> constexpr size_t extent_v
= extent<T, I>::value; // C++17
// See C++14 20.10.6, type relations
template <class T, class U> constexpr bool is_same_v
= is_same<T, U>::value; // C++17
template <class Base, class Derived> constexpr bool is_base_of_v
= is_base_of<Base, Derived>::value; // C++17
template <class From, class To> constexpr bool is_convertible_v
= is_convertible<From, To>::value; // C++17
}
*/ */
#include <__config> #include <__config>
@ -329,11 +469,21 @@ struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
= is_const<_Tp>::value;
#endif
// is_volatile // is_volatile
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
= is_volatile<_Tp>::value;
#endif
// remove_const // remove_const
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;};
@ -366,6 +516,11 @@ template <> struct __libcpp_is_void<void> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void
: public __libcpp_is_void<typename remove_cv<_Tp>::type> {}; : public __libcpp_is_void<typename remove_cv<_Tp>::type> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
= is_void<_Tp>::value;
#endif
// __is_nullptr_t // __is_nullptr_t
template <class _Tp> struct __is_nullptr_t_impl : public false_type {}; template <class _Tp> struct __is_nullptr_t_impl : public false_type {};
@ -377,6 +532,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer
: public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
= is_null_pointer<_Tp>::value;
#endif
#endif #endif
// is_integral // is_integral
@ -407,6 +567,11 @@ template <> struct __libcpp_is_integral<__uint128_t> : public tr
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral
: public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
= is_integral<_Tp>::value;
#endif
// is_floating_point // is_floating_point
template <class _Tp> struct __libcpp_is_floating_point : public false_type {}; template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
@ -417,6 +582,11 @@ template <> struct __libcpp_is_floating_point<long double> : public tru
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point
: public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
= is_floating_point<_Tp>::value;
#endif
// is_array // is_array
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array
@ -426,6 +596,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]>
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]> template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]>
: public true_type {}; : public true_type {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
= is_array<_Tp>::value;
#endif
// is_pointer // is_pointer
template <class _Tp> struct __libcpp_is_pointer : public false_type {}; template <class _Tp> struct __libcpp_is_pointer : public false_type {};
@ -434,6 +609,11 @@ template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer
: public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {}; : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
= is_pointer<_Tp>::value;
#endif
// is_reference // is_reference
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {};
@ -450,6 +630,16 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public t
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {};
#endif #endif
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
= is_reference<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
= is_lvalue_reference<_Tp>::value;
template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
= is_rvalue_reference<_Tp>::value;
#endif
// is_union // is_union
#if __has_feature(is_union) || (_GNUC_VER >= 403) #if __has_feature(is_union) || (_GNUC_VER >= 403)
@ -465,6 +655,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
#endif #endif
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
= is_union<_Tp>::value;
#endif
// is_class // is_class
#if __has_feature(is_class) || (_GNUC_VER >= 403) #if __has_feature(is_class) || (_GNUC_VER >= 403)
@ -485,11 +680,21 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
#endif #endif
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
= is_class<_Tp>::value;
#endif
// is_same // is_same
template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {}; template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
= is_same<_Tp, _Up>::value;
#endif
// is_function // is_function
namespace __libcpp_is_function_imp namespace __libcpp_is_function_imp
@ -515,6 +720,11 @@ template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function
: public __libcpp_is_function<_Tp> {}; : public __libcpp_is_function<_Tp> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
= is_function<_Tp>::value;
#endif
// is_member_function_pointer // is_member_function_pointer
// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; // template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};
@ -537,6 +747,11 @@ struct __libcpp_is_member_function_pointer<_Ret _Class::*>
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
: public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {}; : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
= is_member_function_pointer<_Tp>::value;
#endif
// is_member_pointer // is_member_pointer
template <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; template <class _Tp> struct __libcpp_is_member_pointer : public false_type {};
@ -545,12 +760,22 @@ template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> :
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer
: public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
= is_member_pointer<_Tp>::value;
#endif
// is_member_object_pointer // is_member_object_pointer
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer
: public integral_constant<bool, is_member_pointer<_Tp>::value && : public integral_constant<bool, is_member_pointer<_Tp>::value &&
!is_member_function_pointer<_Tp>::value> {}; !is_member_function_pointer<_Tp>::value> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
= is_member_object_pointer<_Tp>::value;
#endif
// is_enum // is_enum
#if __has_feature(is_enum) || (_GNUC_VER >= 403) #if __has_feature(is_enum) || (_GNUC_VER >= 403)
@ -574,12 +799,22 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
#endif #endif
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
= is_enum<_Tp>::value;
#endif
// is_arithmetic // is_arithmetic
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic
: public integral_constant<bool, is_integral<_Tp>::value || : public integral_constant<bool, is_integral<_Tp>::value ||
is_floating_point<_Tp>::value> {}; is_floating_point<_Tp>::value> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
= is_arithmetic<_Tp>::value;
#endif
// is_fundamental // is_fundamental
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental
@ -587,6 +822,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental
__is_nullptr_t<_Tp>::value || __is_nullptr_t<_Tp>::value ||
is_arithmetic<_Tp>::value> {}; is_arithmetic<_Tp>::value> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
= is_fundamental<_Tp>::value;
#endif
// is_scalar // is_scalar
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar
@ -598,6 +838,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar
template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {}; template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
= is_scalar<_Tp>::value;
#endif
// is_object // is_object
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object
@ -606,11 +851,21 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object
is_union<_Tp>::value || is_union<_Tp>::value ||
is_class<_Tp>::value > {}; is_class<_Tp>::value > {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
= is_object<_Tp>::value;
#endif
// is_compound // is_compound
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound
: public integral_constant<bool, !is_fundamental<_Tp>::value> {}; : public integral_constant<bool, !is_fundamental<_Tp>::value> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
= is_compound<_Tp>::value;
#endif
// add_const // add_const
template <class _Tp, bool = is_reference<_Tp>::value || template <class _Tp, bool = is_reference<_Tp>::value ||
@ -748,6 +1003,11 @@ template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
= is_signed<_Tp>::value;
#endif
// is_unsigned // is_unsigned
template <class _Tp, bool = is_integral<_Tp>::value> template <class _Tp, bool = is_integral<_Tp>::value>
@ -763,6 +1023,11 @@ template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
= is_unsigned<_Tp>::value;
#endif
// rank // rank
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank
@ -851,6 +1116,11 @@ template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
= is_abstract<_Tp>::value;
#endif
// is_final // is_final
#if defined(_LIBCPP_HAS_IS_FINAL) #if defined(_LIBCPP_HAS_IS_FINAL)
@ -866,6 +1136,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
is_final : public integral_constant<bool, __is_final(_Tp)> {}; is_final : public integral_constant<bool, __is_final(_Tp)> {};
#endif #endif
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
= is_final<_Tp>::value;
#endif
// is_base_of // is_base_of
#ifdef _LIBCPP_HAS_IS_BASE_OF #ifdef _LIBCPP_HAS_IS_BASE_OF
@ -1059,6 +1334,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_emp
#endif // __has_feature(is_empty) #endif // __has_feature(is_empty)
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
= is_empty<_Tp>::value;
#endif
// is_polymorphic // is_polymorphic
#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC) #if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC)
@ -1079,6 +1359,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
#endif // __has_feature(is_polymorphic) #endif // __has_feature(is_polymorphic)
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
= is_polymorphic<_Tp>::value;
#endif
// has_virtual_destructor // has_virtual_destructor
#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) #if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403)
@ -3323,6 +3608,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
#endif #endif
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
= is_pod<_Tp>::value;
#endif
// is_literal_type; // is_literal_type;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type
@ -3334,6 +3624,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type
#endif #endif
{}; {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
= is_literal_type<_Tp>::value;
#endif
// is_standard_layout; // is_standard_layout;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
@ -3344,6 +3639,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
#endif #endif
{}; {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
= is_standard_layout<_Tp>::value;
#endif
// is_trivially_copyable; // is_trivially_copyable;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
@ -3356,6 +3656,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
#endif #endif
{}; {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
= is_trivially_copyable<_Tp>::value;
#endif
// is_trivial; // is_trivial;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
@ -3367,6 +3672,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
#endif #endif
{}; {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
= is_trivial<_Tp>::value;
#endif
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
// Check for complete types // Check for complete types

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_array()
{
static_assert( std::is_array<T>::value, "");
static_assert( std::is_array<const T>::value, "");
static_assert( std::is_array<volatile T>::value, "");
static_assert( std::is_array<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_array_v<T>, "");
static_assert( std::is_array_v<const T>, "");
static_assert( std::is_array_v<volatile T>, "");
static_assert( std::is_array_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_array()
{
static_assert(!std::is_array<T>::value, "");
static_assert(!std::is_array<const T>::value, "");
static_assert(!std::is_array<volatile T>::value, "");
static_assert(!std::is_array<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_array_v<T>, "");
static_assert(!std::is_array_v<const T>, "");
static_assert(!std::is_array_v<volatile T>, "");
static_assert(!std::is_array_v<const volatile T>, "");
#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<char[3]>();
test_is_array<char[]>();
test_is_array<Union[]>();
test_is_not_array<std::nullptr_t>();
test_is_not_array<void>();
test_is_not_array<int&>();
test_is_not_array<int&&>();
test_is_not_array<int*>();
test_is_not_array<double>();
test_is_not_array<const int*>();
test_is_not_array<Enum>();
test_is_not_array<Union>();
test_is_not_array<FunctionPtr>();
test_is_not_array<Empty>();
test_is_not_array<bit_zero>();
test_is_not_array<NotEmpty>();
test_is_not_array<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_class()
{
static_assert( std::is_class<T>::value, "");
static_assert( std::is_class<const T>::value, "");
static_assert( std::is_class<volatile T>::value, "");
static_assert( std::is_class<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_class_v<T>, "");
static_assert( std::is_class_v<const T>, "");
static_assert( std::is_class_v<volatile T>, "");
static_assert( std::is_class_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_class()
{
static_assert(!std::is_class<T>::value, "");
static_assert(!std::is_class<const T>::value, "");
static_assert(!std::is_class<volatile T>::value, "");
static_assert(!std::is_class<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_class_v<T>, "");
static_assert(!std::is_class_v<const T>, "");
static_assert(!std::is_class_v<volatile T>, "");
static_assert(!std::is_class_v<const volatile T>, "");
#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<Empty>();
test_is_class<bit_zero>();
test_is_class<NotEmpty>();
test_is_class<Abstract>();
#if TEST_STD_VER >= 11
// In C++03 we have an emulation of std::nullptr_t
test_is_not_class<std::nullptr_t>();
#endif
test_is_not_class<void>();
test_is_not_class<int>();
test_is_not_class<int&>();
#if TEST_STD_VER >= 11
test_is_not_class<int&&>();
#endif
test_is_not_class<int*>();
test_is_not_class<double>();
test_is_not_class<const int*>();
test_is_not_class<char[3]>();
test_is_not_class<char[]>();
test_is_not_class<Enum>();
test_is_not_class<Union>();
test_is_not_class<FunctionPtr>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_enum()
{
static_assert( std::is_enum<T>::value, "");
static_assert( std::is_enum<const T>::value, "");
static_assert( std::is_enum<volatile T>::value, "");
static_assert( std::is_enum<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_enum_v<T>, "");
static_assert( std::is_enum_v<const T>, "");
static_assert( std::is_enum_v<volatile T>, "");
static_assert( std::is_enum_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_enum()
{
static_assert(!std::is_enum<T>::value, "");
static_assert(!std::is_enum<const T>::value, "");
static_assert(!std::is_enum<volatile T>::value, "");
static_assert(!std::is_enum<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_enum_v<T>, "");
static_assert(!std::is_enum_v<const T>, "");
static_assert(!std::is_enum_v<volatile T>, "");
static_assert(!std::is_enum_v<const volatile T>, "");
#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<Enum>();
test_is_not_enum<std::nullptr_t>();
test_is_not_enum<void>();
test_is_not_enum<int>();
test_is_not_enum<int&>();
test_is_not_enum<int&&>();
test_is_not_enum<int*>();
test_is_not_enum<double>();
test_is_not_enum<const int*>();
test_is_not_enum<char[3]>();
test_is_not_enum<char[]>();
test_is_not_enum<Union>();
test_is_not_enum<Empty>();
test_is_not_enum<bit_zero>();
test_is_not_enum<NotEmpty>();
test_is_not_enum<Abstract>();
test_is_not_enum<FunctionPtr>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_floating_point()
{
static_assert( std::is_floating_point<T>::value, "");
static_assert( std::is_floating_point<const T>::value, "");
static_assert( std::is_floating_point<volatile T>::value, "");
static_assert( std::is_floating_point<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_floating_point_v<T>, "");
static_assert( std::is_floating_point_v<const T>, "");
static_assert( std::is_floating_point_v<volatile T>, "");
static_assert( std::is_floating_point_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_floating_point()
{
static_assert(!std::is_floating_point<T>::value, "");
static_assert(!std::is_floating_point<const T>::value, "");
static_assert(!std::is_floating_point<volatile T>::value, "");
static_assert(!std::is_floating_point<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_floating_point_v<T>, "");
static_assert(!std::is_floating_point_v<const T>, "");
static_assert(!std::is_floating_point_v<volatile T>, "");
static_assert(!std::is_floating_point_v<const volatile T>, "");
#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<float>();
test_is_floating_point<double>();
test_is_floating_point<long double>();
test_is_not_floating_point<short>();
test_is_not_floating_point<unsigned short>();
test_is_not_floating_point<int>();
test_is_not_floating_point<unsigned int>();
test_is_not_floating_point<long>();
test_is_not_floating_point<unsigned long>();
test_is_not_floating_point<std::nullptr_t>();
test_is_not_floating_point<void>();
test_is_not_floating_point<int&>();
test_is_not_floating_point<int&&>();
test_is_not_floating_point<int*>();
test_is_not_floating_point<const int*>();
test_is_not_floating_point<char[3]>();
test_is_not_floating_point<char[]>();
test_is_not_floating_point<Union>();
test_is_not_floating_point<Empty>();
test_is_not_floating_point<bit_zero>();
test_is_not_floating_point<NotEmpty>();
test_is_not_floating_point<Abstract>();
test_is_not_floating_point<Enum>();
test_is_not_floating_point<FunctionPtr>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_function()
{
static_assert( std::is_function<T>::value, "");
static_assert( std::is_function<const T>::value, "");
static_assert( std::is_function<volatile T>::value, "");
static_assert( std::is_function<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_function_v<T>, "");
static_assert( std::is_function_v<const T>, "");
static_assert( std::is_function_v<volatile T>, "");
static_assert( std::is_function_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_function()
{
static_assert(!std::is_function<T>::value, "");
static_assert(!std::is_function<const T>::value, "");
static_assert(!std::is_function<volatile T>::value, "");
static_assert(!std::is_function<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_function_v<T>, "");
static_assert(!std::is_function_v<const T>, "");
static_assert(!std::is_function_v<volatile T>, "");
static_assert(!std::is_function_v<const volatile T>, "");
#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<void(void)>();
test_is_function<int(int)>();
test_is_function<int(int, double)>();
test_is_function<int(Abstract *)>();
test_is_function<void(...)>();
test_is_not_function<std::nullptr_t>();
test_is_not_function<void>();
test_is_not_function<int>();
test_is_not_function<int&>();
test_is_not_function<int&&>();
test_is_not_function<int*>();
test_is_not_function<double>();
test_is_not_function<char[3]>();
test_is_not_function<char[]>();
test_is_not_function<Union>();
test_is_not_function<Enum>();
test_is_not_function<FunctionPtr>(); // function pointer is not a function
test_is_not_function<Empty>();
test_is_not_function<bit_zero>();
test_is_not_function<NotEmpty>();
test_is_not_function<Abstract>();
test_is_not_function<Abstract*>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_integral()
{
static_assert( std::is_integral<T>::value, "");
static_assert( std::is_integral<const T>::value, "");
static_assert( std::is_integral<volatile T>::value, "");
static_assert( std::is_integral<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_integral_v<T>, "");
static_assert( std::is_integral_v<const T>, "");
static_assert( std::is_integral_v<volatile T>, "");
static_assert( std::is_integral_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_integral()
{
static_assert(!std::is_integral<T>::value, "");
static_assert(!std::is_integral<const T>::value, "");
static_assert(!std::is_integral<volatile T>::value, "");
static_assert(!std::is_integral<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_integral_v<T>, "");
static_assert(!std::is_integral_v<const T>, "");
static_assert(!std::is_integral_v<volatile T>, "");
static_assert(!std::is_integral_v<const volatile T>, "");
#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<short>();
test_is_integral<unsigned short>();
test_is_integral<int>();
test_is_integral<unsigned int>();
test_is_integral<long>();
test_is_integral<unsigned long>();
test_is_integral<bool>();
test_is_integral<char>();
test_is_integral<signed char>();
test_is_integral<unsigned char>();
test_is_integral<wchar_t>();
test_is_not_integral<std::nullptr_t>();
test_is_not_integral<void>();
test_is_not_integral<int&>();
test_is_not_integral<int&&>();
test_is_not_integral<int*>();
test_is_not_integral<double>();
test_is_not_integral<const int*>();
test_is_not_integral<char[3]>();
test_is_not_integral<char[]>();
test_is_not_integral<Union>();
test_is_not_integral<Enum>();
test_is_not_integral<FunctionPtr>();
test_is_not_integral<Empty>();
test_is_not_integral<bit_zero>();
test_is_not_integral<NotEmpty>();
test_is_not_integral<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_lvalue_reference()
{
static_assert( std::is_lvalue_reference<T>::value, "");
static_assert( std::is_lvalue_reference<const T>::value, "");
static_assert( std::is_lvalue_reference<volatile T>::value, "");
static_assert( std::is_lvalue_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_lvalue_reference_v<T>, "");
static_assert( std::is_lvalue_reference_v<const T>, "");
static_assert( std::is_lvalue_reference_v<volatile T>, "");
static_assert( std::is_lvalue_reference_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_lvalue_reference()
{
static_assert(!std::is_lvalue_reference<T>::value, "");
static_assert(!std::is_lvalue_reference<const T>::value, "");
static_assert(!std::is_lvalue_reference<volatile T>::value, "");
static_assert(!std::is_lvalue_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_lvalue_reference_v<T>, "");
static_assert(!std::is_lvalue_reference_v<const T>, "");
static_assert(!std::is_lvalue_reference_v<volatile T>, "");
static_assert(!std::is_lvalue_reference_v<const volatile T>, "");
#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<int&>();
test_is_not_lvalue_reference<std::nullptr_t>();
test_is_not_lvalue_reference<void>();
test_is_not_lvalue_reference<int>();
test_is_not_lvalue_reference<int*>();
test_is_not_lvalue_reference<int&&>();
test_is_not_lvalue_reference<double>();
test_is_not_lvalue_reference<const int*>();
test_is_not_lvalue_reference<char[3]>();
test_is_not_lvalue_reference<char[]>();
test_is_not_lvalue_reference<Union>();
test_is_not_lvalue_reference<Enum>();
test_is_not_lvalue_reference<FunctionPtr>();
test_is_not_lvalue_reference<Empty>();
test_is_not_lvalue_reference<bit_zero>();
test_is_not_lvalue_reference<NotEmpty>();
test_is_not_lvalue_reference<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_member_object_pointer()
{
static_assert( std::is_member_object_pointer<T>::value, "");
static_assert( std::is_member_object_pointer<const T>::value, "");
static_assert( std::is_member_object_pointer<volatile T>::value, "");
static_assert( std::is_member_object_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_member_object_pointer_v<T>, "");
static_assert( std::is_member_object_pointer_v<const T>, "");
static_assert( std::is_member_object_pointer_v<volatile T>, "");
static_assert( std::is_member_object_pointer_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_member_object_pointer()
{
static_assert(!std::is_member_object_pointer<T>::value, "");
static_assert(!std::is_member_object_pointer<const T>::value, "");
static_assert(!std::is_member_object_pointer<volatile T>::value, "");
static_assert(!std::is_member_object_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_member_object_pointer_v<T>, "");
static_assert(!std::is_member_object_pointer_v<const T>, "");
static_assert(!std::is_member_object_pointer_v<volatile T>, "");
static_assert(!std::is_member_object_pointer_v<const volatile T>, "");
#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<int Abstract::*>();
test_is_member_object_pointer<double NotEmpty::*>();
test_is_member_object_pointer<FunctionPtr Empty::*>();
test_is_not_member_object_pointer<std::nullptr_t>();
test_is_not_member_object_pointer<void>();
test_is_not_member_object_pointer<int>();
test_is_not_member_object_pointer<int&>();
test_is_not_member_object_pointer<int&&>();
test_is_not_member_object_pointer<int*>();
test_is_not_member_object_pointer<double>();
test_is_not_member_object_pointer<const int*>();
test_is_not_member_object_pointer<char[3]>();
test_is_not_member_object_pointer<char[]>();
test_is_not_member_object_pointer<Union>();
test_is_not_member_object_pointer<Enum>();
test_is_not_member_object_pointer<FunctionPtr>();
test_is_not_member_object_pointer<Empty>();
test_is_not_member_object_pointer<bit_zero>();
test_is_not_member_object_pointer<NotEmpty>();
test_is_not_member_object_pointer<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_member_pointer()
{
static_assert( std::is_member_pointer<T>::value, "");
static_assert( std::is_member_pointer<const T>::value, "");
static_assert( std::is_member_pointer<volatile T>::value, "");
static_assert( std::is_member_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_member_pointer_v<T>, "");
static_assert( std::is_member_pointer_v<const T>, "");
static_assert( std::is_member_pointer_v<volatile T>, "");
static_assert( std::is_member_pointer_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_member_pointer()
{
static_assert(!std::is_member_pointer<T>::value, "");
static_assert(!std::is_member_pointer<const T>::value, "");
static_assert(!std::is_member_pointer<volatile T>::value, "");
static_assert(!std::is_member_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_member_pointer_v<T>, "");
static_assert(!std::is_member_pointer_v<const T>, "");
static_assert(!std::is_member_pointer_v<volatile T>, "");
static_assert(!std::is_member_pointer_v<const volatile T>, "");
#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<int Abstract::*>();
test_is_member_pointer<double NotEmpty::*>();
test_is_member_pointer<FunctionPtr Empty::*>();
test_is_member_pointer<void (Empty::*)()>();
test_is_not_member_pointer<std::nullptr_t>();
test_is_not_member_pointer<void>();
test_is_not_member_pointer<int>();
test_is_not_member_pointer<int&>();
test_is_not_member_pointer<int&&>();
test_is_not_member_pointer<int*>();
test_is_not_member_pointer<double>();
test_is_not_member_pointer<const int*>();
test_is_not_member_pointer<char[3]>();
test_is_not_member_pointer<char[]>();
test_is_not_member_pointer<Union>();
test_is_not_member_pointer<Enum>();
test_is_not_member_pointer<FunctionPtr>();
test_is_not_member_pointer<Empty>();
test_is_not_member_pointer<bit_zero>();
test_is_not_member_pointer<NotEmpty>();
test_is_not_member_pointer<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_null_pointer()
{
static_assert( std::is_null_pointer<T>::value, "");
static_assert( std::is_null_pointer<const T>::value, "");
static_assert( std::is_null_pointer<volatile T>::value, "");
static_assert( std::is_null_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_null_pointer_v<T>, "");
static_assert( std::is_null_pointer_v<const T>, "");
static_assert( std::is_null_pointer_v<volatile T>, "");
static_assert( std::is_null_pointer_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_null_pointer()
{
static_assert(!std::is_null_pointer<T>::value, "");
static_assert(!std::is_null_pointer<const T>::value, "");
static_assert(!std::is_null_pointer<volatile T>::value, "");
static_assert(!std::is_null_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_null_pointer_v<T>, "");
static_assert(!std::is_null_pointer_v<const T>, "");
static_assert(!std::is_null_pointer_v<volatile T>, "");
static_assert(!std::is_null_pointer_v<const volatile T>, "");
#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<std::nullptr_t>();
test_is_not_null_pointer<void>();
test_is_not_null_pointer<int>();
test_is_not_null_pointer<int&>();
test_is_not_null_pointer<int&&>();
test_is_not_null_pointer<int*>();
test_is_not_null_pointer<double>();
test_is_not_null_pointer<const int*>();
test_is_not_null_pointer<char[3]>();
test_is_not_null_pointer<char[]>();
test_is_not_null_pointer<Union>();
test_is_not_null_pointer<Enum>();
test_is_not_null_pointer<FunctionPtr>();
test_is_not_null_pointer<Empty>();
test_is_not_null_pointer<bit_zero>();
test_is_not_null_pointer<NotEmpty>();
test_is_not_null_pointer<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_pointer()
{
static_assert( std::is_pointer<T>::value, "");
static_assert( std::is_pointer<const T>::value, "");
static_assert( std::is_pointer<volatile T>::value, "");
static_assert( std::is_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_pointer_v<T>, "");
static_assert( std::is_pointer_v<const T>, "");
static_assert( std::is_pointer_v<volatile T>, "");
static_assert( std::is_pointer_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_pointer()
{
static_assert(!std::is_pointer<T>::value, "");
static_assert(!std::is_pointer<const T>::value, "");
static_assert(!std::is_pointer<volatile T>::value, "");
static_assert(!std::is_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_pointer_v<T>, "");
static_assert(!std::is_pointer_v<const T>, "");
static_assert(!std::is_pointer_v<volatile T>, "");
static_assert(!std::is_pointer_v<const volatile T>, "");
#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<void*>();
test_is_pointer<int*>();
test_is_pointer<const int*>();
test_is_pointer<Abstract*>();
test_is_pointer<FunctionPtr>();
test_is_not_pointer<std::nullptr_t>();
test_is_not_pointer<void>();
test_is_not_pointer<int&>();
test_is_not_pointer<int&&>();
test_is_not_pointer<double>();
test_is_not_pointer<char[3]>();
test_is_not_pointer<char[]>();
test_is_not_pointer<Union>();
test_is_not_pointer<Enum>();
test_is_not_pointer<Empty>();
test_is_not_pointer<bit_zero>();
test_is_not_pointer<NotEmpty>();
test_is_not_pointer<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_rvalue_reference()
{
static_assert( std::is_rvalue_reference<T>::value, "");
static_assert( std::is_rvalue_reference<const T>::value, "");
static_assert( std::is_rvalue_reference<volatile T>::value, "");
static_assert( std::is_rvalue_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_rvalue_reference_v<T>, "");
static_assert( std::is_rvalue_reference_v<const T>, "");
static_assert( std::is_rvalue_reference_v<volatile T>, "");
static_assert( std::is_rvalue_reference_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_rvalue_reference()
{
static_assert(!std::is_rvalue_reference<T>::value, "");
static_assert(!std::is_rvalue_reference<const T>::value, "");
static_assert(!std::is_rvalue_reference<volatile T>::value, "");
static_assert(!std::is_rvalue_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_rvalue_reference_v<T>, "");
static_assert(!std::is_rvalue_reference_v<const T>, "");
static_assert(!std::is_rvalue_reference_v<volatile T>, "");
static_assert(!std::is_rvalue_reference_v<const volatile T>, "");
#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<int&&>();
test_is_not_rvalue_reference<std::nullptr_t>();
test_is_not_rvalue_reference<void>();
test_is_not_rvalue_reference<int>();
test_is_not_rvalue_reference<int*>();
test_is_not_rvalue_reference<int&>();
test_is_not_rvalue_reference<double>();
test_is_not_rvalue_reference<const int*>();
test_is_not_rvalue_reference<char[3]>();
test_is_not_rvalue_reference<char[]>();
test_is_not_rvalue_reference<Union>();
test_is_not_rvalue_reference<Enum>();
test_is_not_rvalue_reference<FunctionPtr>();
test_is_not_rvalue_reference<Empty>();
test_is_not_rvalue_reference<bit_zero>();
test_is_not_rvalue_reference<NotEmpty>();
test_is_not_rvalue_reference<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_union()
{
static_assert( std::is_union<T>::value, "");
static_assert( std::is_union<const T>::value, "");
static_assert( std::is_union<volatile T>::value, "");
static_assert( std::is_union<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_union_v<T>, "");
static_assert( std::is_union_v<const T>, "");
static_assert( std::is_union_v<volatile T>, "");
static_assert( std::is_union_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_union()
{
static_assert(!std::is_union<T>::value, "");
static_assert(!std::is_union<const T>::value, "");
static_assert(!std::is_union<volatile T>::value, "");
static_assert(!std::is_union<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_union_v<T>, "");
static_assert(!std::is_union_v<const T>, "");
static_assert(!std::is_union_v<volatile T>, "");
static_assert(!std::is_union_v<const volatile T>, "");
#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<Union>();
test_is_not_union<std::nullptr_t>();
test_is_not_union<void>();
test_is_not_union<int>();
test_is_not_union<int&>();
test_is_not_union<int&&>();
test_is_not_union<int*>();
test_is_not_union<double>();
test_is_not_union<const int*>();
test_is_not_union<char[3]>();
test_is_not_union<char[]>();
test_is_not_union<Enum>();
test_is_not_union<FunctionPtr>();
test_is_not_union<Empty>();
test_is_not_union<bit_zero>();
test_is_not_union<NotEmpty>();
test_is_not_union<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_void()
{
static_assert( std::is_void<T>::value, "");
static_assert( std::is_void<const T>::value, "");
static_assert( std::is_void<volatile T>::value, "");
static_assert( std::is_void<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_void_v<T>, "");
static_assert( std::is_void_v<const T>, "");
static_assert( std::is_void_v<volatile T>, "");
static_assert( std::is_void_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_void()
{
static_assert(!std::is_void<T>::value, "");
static_assert(!std::is_void<const T>::value, "");
static_assert(!std::is_void<volatile T>::value, "");
static_assert(!std::is_void<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_void_v<T>, "");
static_assert(!std::is_void_v<const T>, "");
static_assert(!std::is_void_v<volatile T>, "");
static_assert(!std::is_void_v<const volatile T>, "");
#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<void>();
test_is_not_void<int>();
test_is_not_void<int*>();
test_is_not_void<int&>();
test_is_not_void<int&&>();
test_is_not_void<double>();
test_is_not_void<const int*>();
test_is_not_void<char[3]>();
test_is_not_void<char[]>();
test_is_not_void<Union>();
test_is_not_void<Empty>();
test_is_not_void<bit_zero>();
test_is_not_void<NotEmpty>();
test_is_not_void<Abstract>();
test_is_not_void<Enum>();
test_is_not_void<FunctionPtr>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_arithmetic()
{
static_assert( std::is_arithmetic<T>::value, "");
static_assert( std::is_arithmetic<const T>::value, "");
static_assert( std::is_arithmetic<volatile T>::value, "");
static_assert( std::is_arithmetic<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_arithmetic_v<T>, "");
static_assert( std::is_arithmetic_v<const T>, "");
static_assert( std::is_arithmetic_v<volatile T>, "");
static_assert( std::is_arithmetic_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_arithmetic()
{
static_assert(!std::is_arithmetic<T>::value, "");
static_assert(!std::is_arithmetic<const T>::value, "");
static_assert(!std::is_arithmetic<volatile T>::value, "");
static_assert(!std::is_arithmetic<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_arithmetic_v<T>, "");
static_assert(!std::is_arithmetic_v<const T>, "");
static_assert(!std::is_arithmetic_v<volatile T>, "");
static_assert(!std::is_arithmetic_v<const volatile T>, "");
#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<short>();
test_is_arithmetic<unsigned short>();
test_is_arithmetic<int>();
test_is_arithmetic<unsigned int>();
test_is_arithmetic<long>();
test_is_arithmetic<unsigned long>();
test_is_arithmetic<bool>();
test_is_arithmetic<char>();
test_is_arithmetic<signed char>();
test_is_arithmetic<unsigned char>();
test_is_arithmetic<wchar_t>();
test_is_arithmetic<double>();
test_is_not_arithmetic<std::nullptr_t>();
test_is_not_arithmetic<void>();
test_is_not_arithmetic<int&>();
test_is_not_arithmetic<int&&>();
test_is_not_arithmetic<int*>();
test_is_not_arithmetic<const int*>();
test_is_not_arithmetic<char[3]>();
test_is_not_arithmetic<char[]>();
test_is_not_arithmetic<Union>();
test_is_not_arithmetic<Enum>();
test_is_not_arithmetic<FunctionPtr>();
test_is_not_arithmetic<Empty>();
test_is_not_arithmetic<bit_zero>();
test_is_not_arithmetic<NotEmpty>();
test_is_not_arithmetic<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_compound()
{
static_assert( std::is_compound<T>::value, "");
static_assert( std::is_compound<const T>::value, "");
static_assert( std::is_compound<volatile T>::value, "");
static_assert( std::is_compound<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_compound_v<T>, "");
static_assert( std::is_compound_v<const T>, "");
static_assert( std::is_compound_v<volatile T>, "");
static_assert( std::is_compound_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_compound()
{
static_assert(!std::is_compound<T>::value, "");
static_assert(!std::is_compound<const T>::value, "");
static_assert(!std::is_compound<volatile T>::value, "");
static_assert(!std::is_compound<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_compound_v<T>, "");
static_assert(!std::is_compound_v<const T>, "");
static_assert(!std::is_compound_v<volatile T>, "");
static_assert(!std::is_compound_v<const volatile T>, "");
#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<char[3]>();
test_is_compound<char[]>();
test_is_compound<void *>();
test_is_compound<FunctionPtr>();
test_is_compound<int&>();
test_is_compound<int&&>();
test_is_compound<Union>();
test_is_compound<Empty>();
test_is_compound<bit_zero>();
test_is_compound<int*>();
test_is_compound<const int*>();
test_is_compound<Enum>();
test_is_compound<NotEmpty>();
test_is_compound<Abstract>();
test_is_not_compound<std::nullptr_t>();
test_is_not_compound<void>();
test_is_not_compound<int>();
test_is_not_compound<double>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_fundamental()
{
static_assert( std::is_fundamental<T>::value, "");
static_assert( std::is_fundamental<const T>::value, "");
static_assert( std::is_fundamental<volatile T>::value, "");
static_assert( std::is_fundamental<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_fundamental_v<T>, "");
static_assert( std::is_fundamental_v<const T>, "");
static_assert( std::is_fundamental_v<volatile T>, "");
static_assert( std::is_fundamental_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_fundamental()
{
static_assert(!std::is_fundamental<T>::value, "");
static_assert(!std::is_fundamental<const T>::value, "");
static_assert(!std::is_fundamental<volatile T>::value, "");
static_assert(!std::is_fundamental<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_fundamental_v<T>, "");
static_assert(!std::is_fundamental_v<const T>, "");
static_assert(!std::is_fundamental_v<volatile T>, "");
static_assert(!std::is_fundamental_v<const volatile T>, "");
#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<std::nullptr_t>();
test_is_fundamental<void>();
test_is_fundamental<short>();
test_is_fundamental<unsigned short>();
test_is_fundamental<int>();
test_is_fundamental<unsigned int>();
test_is_fundamental<long>();
test_is_fundamental<unsigned long>();
test_is_fundamental<long long>();
test_is_fundamental<unsigned long long>();
test_is_fundamental<bool>();
test_is_fundamental<char>();
test_is_fundamental<signed char>();
test_is_fundamental<unsigned char>();
test_is_fundamental<wchar_t>();
test_is_fundamental<double>();
test_is_fundamental<float>();
test_is_fundamental<double>();
test_is_fundamental<long double>();
test_is_fundamental<char16_t>();
test_is_fundamental<char32_t>();
test_is_not_fundamental<char[3]>();
test_is_not_fundamental<char[]>();
test_is_not_fundamental<void *>();
test_is_not_fundamental<FunctionPtr>();
test_is_not_fundamental<int&>();
test_is_not_fundamental<int&&>();
test_is_not_fundamental<Union>();
test_is_not_fundamental<Empty>();
test_is_not_fundamental<bit_zero>();
test_is_not_fundamental<int*>();
test_is_not_fundamental<const int*>();
test_is_not_fundamental<Enum>();
test_is_not_fundamental<NotEmpty>();
test_is_not_fundamental<Abstract>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_member_pointer()
{
static_assert( std::is_member_pointer<T>::value, "");
static_assert( std::is_member_pointer<const T>::value, "");
static_assert( std::is_member_pointer<volatile T>::value, "");
static_assert( std::is_member_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_member_pointer_v<T>, "");
static_assert( std::is_member_pointer_v<const T>, "");
static_assert( std::is_member_pointer_v<volatile T>, "");
static_assert( std::is_member_pointer_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_member_pointer()
{
static_assert(!std::is_member_pointer<T>::value, "");
static_assert(!std::is_member_pointer<const T>::value, "");
static_assert(!std::is_member_pointer<volatile T>::value, "");
static_assert(!std::is_member_pointer<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_member_pointer_v<T>, "");
static_assert(!std::is_member_pointer_v<const T>, "");
static_assert(!std::is_member_pointer_v<volatile T>, "");
static_assert(!std::is_member_pointer_v<const volatile T>, "");
#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<int Empty::*>();
test_is_member_pointer<void (Empty::*)(int)>();
test_is_not_member_pointer<std::nullptr_t>();
test_is_not_member_pointer<void>();
test_is_not_member_pointer<void *>();
test_is_not_member_pointer<int>();
test_is_not_member_pointer<int*>();
test_is_not_member_pointer<const int*>();
test_is_not_member_pointer<int&>();
test_is_not_member_pointer<int&&>();
test_is_not_member_pointer<double>();
test_is_not_member_pointer<char[3]>();
test_is_not_member_pointer<char[]>();
test_is_not_member_pointer<Union>();
test_is_not_member_pointer<Empty>();
test_is_not_member_pointer<bit_zero>();
test_is_not_member_pointer<NotEmpty>();
test_is_not_member_pointer<Abstract>();
test_is_not_member_pointer<int(int)>();
test_is_not_member_pointer<Enum>();
test_is_not_member_pointer<FunctionPtr>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_object()
{
static_assert( std::is_object<T>::value, "");
static_assert( std::is_object<const T>::value, "");
static_assert( std::is_object<volatile T>::value, "");
static_assert( std::is_object<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_object_v<T>, "");
static_assert( std::is_object_v<const T>, "");
static_assert( std::is_object_v<volatile T>, "");
static_assert( std::is_object_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_object()
{
static_assert(!std::is_object<T>::value, "");
static_assert(!std::is_object<const T>::value, "");
static_assert(!std::is_object<volatile T>::value, "");
static_assert(!std::is_object<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_object_v<T>, "");
static_assert(!std::is_object_v<const T>, "");
static_assert(!std::is_object_v<volatile T>, "");
static_assert(!std::is_object_v<const volatile T>, "");
#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<std::nullptr_t>();
test_is_object<void *>();
test_is_object<char[3]>();
test_is_object<char[]>();
test_is_object<int>();
test_is_object<int*>();
test_is_object<Union>();
test_is_object<int*>();
test_is_object<const int*>();
test_is_object<Enum>();
test_is_object<Empty>();
test_is_object<bit_zero>();
test_is_object<NotEmpty>();
test_is_object<Abstract>();
test_is_object<FunctionPtr>();
test_is_object<int Empty::*>();
test_is_object<void (Empty::*)(int)>();
test_is_not_object<void>();
test_is_not_object<int&>();
test_is_not_object<int&&>();
test_is_not_object<int(int)>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_reference()
{
static_assert( std::is_reference<T>::value, "");
static_assert( std::is_reference<const T>::value, "");
static_assert( std::is_reference<volatile T>::value, "");
static_assert( std::is_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_reference_v<T>, "");
static_assert( std::is_reference_v<const T>, "");
static_assert( std::is_reference_v<volatile T>, "");
static_assert( std::is_reference_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_reference()
{
static_assert(!std::is_reference<T>::value, "");
static_assert(!std::is_reference<const T>::value, "");
static_assert(!std::is_reference<volatile T>::value, "");
static_assert(!std::is_reference<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_reference_v<T>, "");
static_assert(!std::is_reference_v<const T>, "");
static_assert(!std::is_reference_v<volatile T>, "");
static_assert(!std::is_reference_v<const volatile T>, "");
#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<int&>();
#if TEST_STD_VER >= 11
test_is_reference<int&&>();
#endif
test_is_not_reference<std::nullptr_t>();
test_is_not_reference<void>();
test_is_not_reference<int>();
test_is_not_reference<double>();
test_is_not_reference<char[3]>();
test_is_not_reference<char[]>();
test_is_not_reference<void *>();
test_is_not_reference<FunctionPtr>();
test_is_not_reference<Union>();
test_is_not_reference<Empty>();
test_is_not_reference<bit_zero>();
test_is_not_reference<int*>();
test_is_not_reference<const int*>();
test_is_not_reference<Enum>();
test_is_not_reference<NotEmpty>();
test_is_not_reference<Abstract>();
test_is_not_reference<int(int)>();
test_is_not_reference<int Empty::*>();
test_is_not_reference<void (Empty::*)(int)>();
}

View File

@ -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 <type_traits>
#include "test_macros.h"
template <class T>
void test_is_scalar()
{
static_assert( std::is_scalar<T>::value, "");
static_assert( std::is_scalar<const T>::value, "");
static_assert( std::is_scalar<volatile T>::value, "");
static_assert( std::is_scalar<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_scalar_v<T>, "");
static_assert( std::is_scalar_v<const T>, "");
static_assert( std::is_scalar_v<volatile T>, "");
static_assert( std::is_scalar_v<const volatile T>, "");
#endif
}
template <class T>
void test_is_not_scalar()
{
static_assert(!std::is_scalar<T>::value, "");
static_assert(!std::is_scalar<const T>::value, "");
static_assert(!std::is_scalar<volatile T>::value, "");
static_assert(!std::is_scalar<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_scalar_v<T>, "");
static_assert(!std::is_scalar_v<const T>, "");
static_assert(!std::is_scalar_v<volatile T>, "");
static_assert(!std::is_scalar_v<const volatile T>, "");
#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<std::nullptr_t>();
test_is_scalar<short>();
test_is_scalar<unsigned short>();
test_is_scalar<int>();
test_is_scalar<unsigned int>();
test_is_scalar<long>();
test_is_scalar<unsigned long>();
test_is_scalar<bool>();
test_is_scalar<char>();
test_is_scalar<signed char>();
test_is_scalar<unsigned char>();
test_is_scalar<wchar_t>();
test_is_scalar<double>();
test_is_scalar<int*>();
test_is_scalar<const int*>();
test_is_scalar<int Empty::*>();
test_is_scalar<void (Empty::*)(int)>();
test_is_scalar<Enum>();
test_is_scalar<FunctionPtr>();
test_is_not_scalar<void>();
test_is_not_scalar<int&>();
test_is_not_scalar<int&&>();
test_is_not_scalar<char[3]>();
test_is_not_scalar<char[]>();
test_is_not_scalar<Union>();
test_is_not_scalar<Empty>();
test_is_not_scalar<bit_zero>();
test_is_not_scalar<NotEmpty>();
test_is_not_scalar<Abstract>();
test_is_not_scalar<int(int)>();
}

View File

@ -12,6 +12,7 @@
// is_abstract // is_abstract
#include <type_traits> #include <type_traits>
#include "test_macros.h"
template <class T> template <class T>
void test_is_abstract() void test_is_abstract()
@ -20,6 +21,12 @@ void test_is_abstract()
static_assert( std::is_abstract<const T>::value, ""); static_assert( std::is_abstract<const T>::value, "");
static_assert( std::is_abstract<volatile T>::value, ""); static_assert( std::is_abstract<volatile T>::value, "");
static_assert( std::is_abstract<const volatile T>::value, ""); static_assert( std::is_abstract<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_abstract_v<T>, "");
static_assert( std::is_abstract_v<const T>, "");
static_assert( std::is_abstract_v<volatile T>, "");
static_assert( std::is_abstract_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +36,12 @@ void test_is_not_abstract()
static_assert(!std::is_abstract<const T>::value, ""); static_assert(!std::is_abstract<const T>::value, "");
static_assert(!std::is_abstract<volatile T>::value, ""); static_assert(!std::is_abstract<volatile T>::value, "");
static_assert(!std::is_abstract<const volatile T>::value, ""); static_assert(!std::is_abstract<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_abstract_v<T>, "");
static_assert(!std::is_abstract_v<const T>, "");
static_assert(!std::is_abstract_v<volatile T>, "");
static_assert(!std::is_abstract_v<const volatile T>, "");
#endif
} }
class Empty class Empty

View File

@ -20,6 +20,12 @@ void test_is_const()
static_assert( std::is_const<const T>::value, ""); static_assert( std::is_const<const T>::value, "");
static_assert(!std::is_const<volatile T>::value, ""); static_assert(!std::is_const<volatile T>::value, "");
static_assert( std::is_const<const volatile T>::value, ""); static_assert( std::is_const<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_const_v<T>::value, "");
static_assert( std::is_const_v<const T>, "");
static_assert(!std::is_const_v<volatile T>, "");
static_assert( std::is_const_v<const volatile T>, "");
#endif
} }
int main() int main()

View File

@ -20,6 +20,12 @@ void test_is_empty()
static_assert( std::is_empty<const T>::value, ""); static_assert( std::is_empty<const T>::value, "");
static_assert( std::is_empty<volatile T>::value, ""); static_assert( std::is_empty<volatile T>::value, "");
static_assert( std::is_empty<const volatile T>::value, ""); static_assert( std::is_empty<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_empty_v<T>, "");
static_assert( std::is_empty_v<const T>, "");
static_assert( std::is_empty_v<volatile T>, "");
static_assert( std::is_empty_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +35,12 @@ void test_is_not_empty()
static_assert(!std::is_empty<const T>::value, ""); static_assert(!std::is_empty<const T>::value, "");
static_assert(!std::is_empty<volatile T>::value, ""); static_assert(!std::is_empty<volatile T>::value, "");
static_assert(!std::is_empty<const volatile T>::value, ""); static_assert(!std::is_empty<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_empty_v<T>, "");
static_assert(!std::is_empty_v<const T>, "");
static_assert(!std::is_empty_v<volatile T>, "");
static_assert(!std::is_empty_v<const volatile T>, "");
#endif
} }
class Empty class Empty

View File

@ -26,6 +26,12 @@ void test_is_final()
static_assert( std::is_final<const T>::value, ""); static_assert( std::is_final<const T>::value, "");
static_assert( std::is_final<volatile T>::value, ""); static_assert( std::is_final<volatile T>::value, "");
static_assert( std::is_final<const volatile T>::value, ""); static_assert( std::is_final<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_final_v<T>, "");
static_assert( std::is_final_v<const T>, "");
static_assert( std::is_final_v<volatile T>, "");
static_assert( std::is_final_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -35,6 +41,12 @@ void test_is_not_final()
static_assert(!std::is_final<const T>::value, ""); static_assert(!std::is_final<const T>::value, "");
static_assert(!std::is_final<volatile T>::value, ""); static_assert(!std::is_final<volatile T>::value, "");
static_assert(!std::is_final<const volatile T>::value, ""); static_assert(!std::is_final<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_final_v<T>, "");
static_assert(!std::is_final_v<const T>, "");
static_assert(!std::is_final_v<volatile T>, "");
static_assert(!std::is_final_v<const volatile T>, "");
#endif
} }
int main () int main ()

View File

@ -17,12 +17,26 @@ template <class T>
void test_is_literal_type() void test_is_literal_type()
{ {
static_assert( std::is_literal_type<T>::value, ""); static_assert( std::is_literal_type<T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_literal_type_v<T>, "");
// static_assert( std::is_final_v<T>, "");
// static_assert( std::is_final_v<const T>, "");
// static_assert( std::is_final_v<volatile T>, "");
// static_assert( std::is_final_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
void test_is_not_literal_type() void test_is_not_literal_type()
{ {
static_assert(!std::is_literal_type<T>::value, ""); static_assert(!std::is_literal_type<T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_literal_type_v<T>, "");
// static_assert( std::is_final_v<T>, "");
// static_assert( std::is_final_v<const T>, "");
// static_assert( std::is_final_v<volatile T>, "");
// static_assert( std::is_final_v<const volatile T>, "");
#endif
} }
struct A struct A

View File

@ -20,6 +20,12 @@ void test_is_pod()
static_assert( std::is_pod<const T>::value, ""); static_assert( std::is_pod<const T>::value, "");
static_assert( std::is_pod<volatile T>::value, ""); static_assert( std::is_pod<volatile T>::value, "");
static_assert( std::is_pod<const volatile T>::value, ""); static_assert( std::is_pod<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_pod_v<T>, "");
static_assert( std::is_pod_v<const T>, "");
static_assert( std::is_pod_v<volatile T>, "");
static_assert( std::is_pod_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +35,12 @@ void test_is_not_pod()
static_assert(!std::is_pod<const T>::value, ""); static_assert(!std::is_pod<const T>::value, "");
static_assert(!std::is_pod<volatile T>::value, ""); static_assert(!std::is_pod<volatile T>::value, "");
static_assert(!std::is_pod<const volatile T>::value, ""); static_assert(!std::is_pod<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_pod_v<T>, "");
static_assert( std::is_pod_v<const T>, "");
static_assert( std::is_pod_v<volatile T>, "");
static_assert( std::is_pod_v<const volatile T>, "");
#endif
} }
class Class class Class

View File

@ -20,6 +20,12 @@ void test_is_polymorphic()
static_assert( std::is_polymorphic<const T>::value, ""); static_assert( std::is_polymorphic<const T>::value, "");
static_assert( std::is_polymorphic<volatile T>::value, ""); static_assert( std::is_polymorphic<volatile T>::value, "");
static_assert( std::is_polymorphic<const volatile T>::value, ""); static_assert( std::is_polymorphic<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_polymorphic_v<T>, "");
static_assert( std::is_polymorphic_v<const T>, "");
static_assert( std::is_polymorphic_v<volatile T>, "");
static_assert( std::is_polymorphic_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +35,12 @@ void test_is_not_polymorphic()
static_assert(!std::is_polymorphic<const T>::value, ""); static_assert(!std::is_polymorphic<const T>::value, "");
static_assert(!std::is_polymorphic<volatile T>::value, ""); static_assert(!std::is_polymorphic<volatile T>::value, "");
static_assert(!std::is_polymorphic<const volatile T>::value, ""); static_assert(!std::is_polymorphic<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_polymorphic_v<T>, "");
static_assert(!std::is_polymorphic_v<const T>, "");
static_assert(!std::is_polymorphic_v<volatile T>, "");
static_assert(!std::is_polymorphic_v<const volatile T>, "");
#endif
} }
class Empty class Empty

View File

@ -20,6 +20,12 @@ void test_is_signed()
static_assert( std::is_signed<const T>::value, ""); static_assert( std::is_signed<const T>::value, "");
static_assert( std::is_signed<volatile T>::value, ""); static_assert( std::is_signed<volatile T>::value, "");
static_assert( std::is_signed<const volatile T>::value, ""); static_assert( std::is_signed<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_signed_v<T>, "");
static_assert( std::is_signed_v<const T>, "");
static_assert( std::is_signed_v<volatile T>, "");
static_assert( std::is_signed_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +35,12 @@ void test_is_not_signed()
static_assert(!std::is_signed<const T>::value, ""); static_assert(!std::is_signed<const T>::value, "");
static_assert(!std::is_signed<volatile T>::value, ""); static_assert(!std::is_signed<volatile T>::value, "");
static_assert(!std::is_signed<const volatile T>::value, ""); static_assert(!std::is_signed<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_signed_v<T>, "");
static_assert(!std::is_signed_v<const T>, "");
static_assert(!std::is_signed_v<volatile T>, "");
static_assert(!std::is_signed_v<const volatile T>, "");
#endif
} }
class Class class Class

View File

@ -20,6 +20,12 @@ void test_is_standard_layout()
static_assert( std::is_standard_layout<const T>::value, ""); static_assert( std::is_standard_layout<const T>::value, "");
static_assert( std::is_standard_layout<volatile T>::value, ""); static_assert( std::is_standard_layout<volatile T>::value, "");
static_assert( std::is_standard_layout<const volatile T>::value, ""); static_assert( std::is_standard_layout<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_standard_layout_v<T>, "");
static_assert( std::is_standard_layout_v<const T>, "");
static_assert( std::is_standard_layout_v<volatile T>, "");
static_assert( std::is_standard_layout_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +35,12 @@ void test_is_not_standard_layout()
static_assert(!std::is_standard_layout<const T>::value, ""); static_assert(!std::is_standard_layout<const T>::value, "");
static_assert(!std::is_standard_layout<volatile T>::value, ""); static_assert(!std::is_standard_layout<volatile T>::value, "");
static_assert(!std::is_standard_layout<const volatile T>::value, ""); static_assert(!std::is_standard_layout<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_standard_layout_v<T>, "");
static_assert(!std::is_standard_layout_v<const T>, "");
static_assert(!std::is_standard_layout_v<volatile T>, "");
static_assert(!std::is_standard_layout_v<const volatile T>, "");
#endif
} }
template <class T1, class T2> template <class T1, class T2>

View File

@ -20,6 +20,12 @@ void test_is_trivial()
static_assert( std::is_trivial<const T>::value, ""); static_assert( std::is_trivial<const T>::value, "");
static_assert( std::is_trivial<volatile T>::value, ""); static_assert( std::is_trivial<volatile T>::value, "");
static_assert( std::is_trivial<const volatile T>::value, ""); static_assert( std::is_trivial<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_trivial_v<T>, "");
static_assert( std::is_trivial_v<const T>, "");
static_assert( std::is_trivial_v<volatile T>, "");
static_assert( std::is_trivial_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +35,12 @@ void test_is_not_trivial()
static_assert(!std::is_trivial<const T>::value, ""); static_assert(!std::is_trivial<const T>::value, "");
static_assert(!std::is_trivial<volatile T>::value, ""); static_assert(!std::is_trivial<volatile T>::value, "");
static_assert(!std::is_trivial<const volatile T>::value, ""); static_assert(!std::is_trivial<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_trivial_v<T>, "");
static_assert(!std::is_trivial_v<const T>, "");
static_assert(!std::is_trivial_v<volatile T>, "");
static_assert(!std::is_trivial_v<const volatile T>, "");
#endif
} }
struct A {}; struct A {};

View File

@ -21,6 +21,12 @@ void test_is_trivially_copyable()
static_assert( std::is_trivially_copyable<const T>::value, ""); static_assert( std::is_trivially_copyable<const T>::value, "");
static_assert(!std::is_trivially_copyable<volatile T>::value, ""); static_assert(!std::is_trivially_copyable<volatile T>::value, "");
static_assert(!std::is_trivially_copyable<const volatile T>::value, ""); static_assert(!std::is_trivially_copyable<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_trivially_copyable_v<T>, "");
static_assert( std::is_trivially_copyable_v<const T>, "");
static_assert(!std::is_trivially_copyable_v<volatile T>, "");
static_assert(!std::is_trivially_copyable_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -30,6 +36,12 @@ void test_is_not_trivially_copyable()
static_assert(!std::is_trivially_copyable<const T>::value, ""); static_assert(!std::is_trivially_copyable<const T>::value, "");
static_assert(!std::is_trivially_copyable<volatile T>::value, ""); static_assert(!std::is_trivially_copyable<volatile T>::value, "");
static_assert(!std::is_trivially_copyable<const volatile T>::value, ""); static_assert(!std::is_trivially_copyable<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_trivially_copyable_v<T>, "");
static_assert(!std::is_trivially_copyable_v<const T>, "");
static_assert(!std::is_trivially_copyable_v<volatile T>, "");
static_assert(!std::is_trivially_copyable_v<const volatile T>, "");
#endif
} }
struct A struct A

View File

@ -20,6 +20,12 @@ void test_is_unsigned()
static_assert( std::is_unsigned<const T>::value, ""); static_assert( std::is_unsigned<const T>::value, "");
static_assert( std::is_unsigned<volatile T>::value, ""); static_assert( std::is_unsigned<volatile T>::value, "");
static_assert( std::is_unsigned<const volatile T>::value, ""); static_assert( std::is_unsigned<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert( std::is_unsigned_v<T>, "");
static_assert( std::is_unsigned_v<const T>, "");
static_assert( std::is_unsigned_v<volatile T>, "");
static_assert( std::is_unsigned_v<const volatile T>, "");
#endif
} }
template <class T> template <class T>
@ -29,6 +35,12 @@ void test_is_not_unsigned()
static_assert(!std::is_unsigned<const T>::value, ""); static_assert(!std::is_unsigned<const T>::value, "");
static_assert(!std::is_unsigned<volatile T>::value, ""); static_assert(!std::is_unsigned<volatile T>::value, "");
static_assert(!std::is_unsigned<const volatile T>::value, ""); static_assert(!std::is_unsigned<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_unsigned_v<T>, "");
static_assert(!std::is_unsigned_v<const T>, "");
static_assert(!std::is_unsigned_v<volatile T>, "");
static_assert(!std::is_unsigned_v<const volatile T>, "");
#endif
} }
class Class class Class

View File

@ -20,6 +20,12 @@ void test_is_volatile()
static_assert(!std::is_volatile<const T>::value, ""); static_assert(!std::is_volatile<const T>::value, "");
static_assert( std::is_volatile<volatile T>::value, ""); static_assert( std::is_volatile<volatile T>::value, "");
static_assert( std::is_volatile<const volatile T>::value, ""); static_assert( std::is_volatile<const volatile T>::value, "");
#if TEST_STD_VER > 14
static_assert(!std::is_volatile_v<T>, "");
static_assert(!std::is_volatile_v<const T>, "");
static_assert( std::is_volatile_v<volatile T>, "");
static_assert( std::is_volatile_v<const volatile T>, "");
#endif
} }
int main() int main()