From 1711a6ec650980764d97b3be148745e2813a3707 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Wed, 22 Sep 2021 09:46:19 -0400 Subject: [PATCH] [libc++] Remove uses of _LIBCPP_HAS_NO_VARIABLE_TEMPLATES All supported compilers provide support for variable templates now. Differential Revision: https://reviews.llvm.org/D110284 --- libcxx/include/__config | 11 -- libcxx/include/chrono | 2 +- libcxx/include/ratio | 2 +- libcxx/include/type_traits | 172 +++++++++++------------ libcxx/test/libcxx/selftest/test_macros.pass.cpp | 21 +-- libcxx/test/support/test_macros.h | 14 -- 6 files changed, 87 insertions(+), 135 deletions(-) diff --git a/libcxx/include/__config b/libcxx/include/__config index ae5d277..eab6ffb 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -484,10 +484,6 @@ typedef __char32_t char32_t; # define _LIBCPP_HAS_BLOCKS_RUNTIME #endif -#if !(__has_feature(cxx_variable_templates)) -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#endif - #if !(__has_feature(cxx_noexcept)) #define _LIBCPP_HAS_NO_NOEXCEPT #endif @@ -516,11 +512,6 @@ typedef __char32_t char32_t; # define _LIBCPP_NO_EXCEPTIONS #endif -// GCC 5 supports variable templates -#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#endif - #if !defined(__SANITIZE_ADDRESS__) #define _LIBCPP_HAS_NO_ASAN #endif @@ -539,7 +530,6 @@ typedef __char32_t char32_t; #error "MSVC versions prior to Visual Studio 2015 are not supported" #endif -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #define __alignof__ __alignof #define _LIBCPP_NORETURN __declspec(noreturn) #define _ALIGNAS(x) __declspec(align(x)) @@ -563,7 +553,6 @@ typedef __char32_t char32_t; #define _LIBCPP_NORETURN __attribute__((noreturn)) #define _LIBCPP_HAS_NO_UNICODE_CHARS -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #if defined(_AIX) #define __MULTILOCALE_API diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 6877291..48a8665 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -950,7 +950,7 @@ duration_cast(const duration<_Rep, _Period>& __fd) template struct _LIBCPP_TEMPLATE_VIS treat_as_floating_point : is_floating_point<_Rep> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>::value; #endif diff --git a/libcxx/include/ratio b/libcxx/include/ratio index 622b7a0..16d3b2b 100644 --- a/libcxx/include/ratio +++ b/libcxx/include/ratio @@ -499,7 +499,7 @@ struct __ratio_gcd __static_lcm<_R1::den, _R2::den>::value> type; }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value; diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index eac0466..7ad48d8 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -555,7 +555,7 @@ template using conditional_t = typename condi template struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_same_v = __is_same(_Tp, _Up); #endif @@ -565,7 +565,7 @@ inline constexpr bool is_same_v = __is_same(_Tp, _Up); template struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {}; template struct _LIBCPP_TEMPLATE_VIS is_same<_Tp, _Tp> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_same_v = is_same<_Tp, _Up>::value; #endif @@ -611,7 +611,7 @@ struct __two {char __lx[2];}; template struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_const_v = __is_const(_Tp); #endif @@ -621,7 +621,7 @@ inline constexpr bool is_const_v = __is_const(_Tp); template struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {}; template struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_const_v = is_const<_Tp>::value; #endif @@ -635,7 +635,7 @@ inline constexpr bool is_const_v = is_const<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_volatile_v = __is_volatile(_Tp); #endif @@ -645,7 +645,7 @@ inline constexpr bool is_volatile_v = __is_volatile(_Tp); template struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {}; template struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_volatile_v = is_volatile<_Tp>::value; #endif @@ -722,7 +722,7 @@ template using remove_cv_t = typename remove_cv<_Tp>::type; template struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_void_v = __is_void(_Tp); #endif @@ -732,7 +732,7 @@ inline constexpr bool is_void_v = __is_void(_Tp); template struct _LIBCPP_TEMPLATE_VIS is_void : public is_same::type, void> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_void_v = is_void<_Tp>::value; #endif @@ -751,7 +751,7 @@ template struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t template struct _LIBCPP_TEMPLATE_VIS is_null_pointer : public __is_nullptr_t_impl::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; #endif @@ -774,7 +774,7 @@ inline constexpr bool is_integral_v = __is_integral(_Tp); template struct _LIBCPP_TEMPLATE_VIS is_integral : public _BoolConstant<__libcpp_is_integral::type>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_integral_v = is_integral<_Tp>::value; #endif @@ -817,7 +817,7 @@ template <> struct __libcpp_is_floating_point : public tru template struct _LIBCPP_TEMPLATE_VIS is_floating_point : public __libcpp_is_floating_point::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; #endif @@ -829,7 +829,7 @@ inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_array_v = __is_array(_Tp); #endif @@ -843,7 +843,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> template struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_array_v = is_array<_Tp>::value; #endif @@ -860,7 +860,7 @@ inline constexpr bool is_array_v = is_array<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_pointer_v = __is_pointer(_Tp); #endif @@ -881,7 +881,7 @@ template struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretai template struct _LIBCPP_TEMPLATE_VIS is_pointer : public __libcpp_is_pointer::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; #endif @@ -903,7 +903,7 @@ struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_refe template struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_reference_v = __is_reference(_Tp); template @@ -924,7 +924,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_reference : public fa template struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; template struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_reference_v = is_reference<_Tp>::value; @@ -952,7 +952,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_union #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_union_v = is_union<_Tp>::value; #endif @@ -977,7 +977,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_class #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_class_v = is_class<_Tp>::value; #endif @@ -994,7 +994,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_function > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_function_v = is_function<_Tp>::value; #endif @@ -1020,7 +1020,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); #endif @@ -1030,7 +1030,7 @@ inline constexpr bool is_member_function_pointer_v = __is_member_function_pointe template struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : public _BoolConstant< __libcpp_is_member_pointer::type>::__is_func > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; #endif @@ -1044,7 +1044,7 @@ inline constexpr bool is_member_function_pointer_v = is_member_function_pointer< template struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); #endif @@ -1054,7 +1054,7 @@ inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); template struct _LIBCPP_TEMPLATE_VIS is_member_pointer : public _BoolConstant< __libcpp_is_member_pointer::type>::__is_member > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; #endif @@ -1069,7 +1069,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); #endif @@ -1079,7 +1079,7 @@ inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_T template struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : public _BoolConstant< __libcpp_is_member_pointer::type>::__is_obj > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; #endif @@ -1093,7 +1093,7 @@ inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp> template struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_enum_v = __is_enum(_Tp); #endif @@ -1112,7 +1112,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_enum !is_class<_Tp>::value && !is_function<_Tp>::value > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_enum_v = is_enum<_Tp>::value; #endif @@ -1126,7 +1126,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_arithmetic : public integral_constant::value || is_floating_point<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; #endif @@ -1142,7 +1142,7 @@ inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); #endif @@ -1154,7 +1154,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_fundamental __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; #endif @@ -1169,7 +1169,7 @@ inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_scalar_v = __is_scalar(_Tp); #endif @@ -1191,7 +1191,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_scalar template <> struct _LIBCPP_TEMPLATE_VIS is_scalar : public true_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; #endif @@ -1205,7 +1205,7 @@ inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_object_v = __is_object(_Tp); #endif @@ -1218,7 +1218,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_object is_union<_Tp>::value || is_class<_Tp>::value > {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_object_v = is_object<_Tp>::value; #endif @@ -1233,7 +1233,7 @@ inline constexpr bool is_object_v = is_object<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_compound_v = __is_compound(_Tp); #endif @@ -1243,7 +1243,7 @@ inline constexpr bool is_compound_v = __is_compound(_Tp); template struct _LIBCPP_TEMPLATE_VIS is_compound : public integral_constant::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_compound_v = is_compound<_Tp>::value; #endif @@ -1424,7 +1424,7 @@ template using type_identity_t = typename type_identity<_Tp>::type; template struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_signed_v = __is_signed(_Tp); #endif @@ -1444,7 +1444,7 @@ template struct __libcpp_is_signed<_Tp, false> : public false_type { template struct _LIBCPP_TEMPLATE_VIS is_signed : public __libcpp_is_signed<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_signed_v = is_signed<_Tp>::value; #endif @@ -1462,7 +1462,7 @@ inline constexpr bool is_signed_v = is_signed<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); #endif @@ -1482,7 +1482,7 @@ template struct __libcpp_is_unsigned<_Tp, false> : public false_type template struct _LIBCPP_TEMPLATE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; #endif @@ -1498,7 +1498,7 @@ template struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> template struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> : public integral_constant::value + 1> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr size_t rank_v = rank<_Tp>::value; #endif @@ -1511,7 +1511,7 @@ template struct _LIBCPP_TEMPLATE_VIS extent : integral_constant { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); #endif @@ -1529,7 +1529,7 @@ template struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], 0> template struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], _Ip> : public integral_constant::value> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr size_t extent_v = extent<_Tp, _Ip>::value; #endif @@ -1623,7 +1623,7 @@ template using decay_t = typename decay<_Tp>::type; template struct _LIBCPP_TEMPLATE_VIS is_abstract : public integral_constant {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_abstract_v = is_abstract<_Tp>::value; #endif @@ -1638,7 +1638,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_final : public integral_constant {}; #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_final_v = is_final<_Tp>::value; #endif @@ -1649,10 +1649,8 @@ inline constexpr bool is_final_v = is_final<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant {}; -#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value; -#endif #endif // _LIBCPP_STD_VER > 14 @@ -1662,7 +1660,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_base_of : public integral_constant {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value; #endif @@ -1758,7 +1756,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_convertible #endif // __has_feature(is_convertible_to) -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; #endif @@ -1820,7 +1818,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_empty : public __libcpp_empt #endif // __has_feature(is_empty) -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_empty_v = is_empty<_Tp>::value; #endif @@ -1845,7 +1843,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_polymorphic #endif // __has_feature(is_polymorphic) -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value; #endif @@ -1864,7 +1862,7 @@ template struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value; #endif @@ -1877,10 +1875,8 @@ template struct _LIBCPP_TEMPLATE_VIS has_unique_object_representatio : public integral_constant>)> {}; -#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value; -#endif #endif @@ -1889,7 +1885,7 @@ inline constexpr bool has_unique_object_representations_v = has_unique_object_re template struct _LIBCPP_TEMPLATE_VIS alignment_of : public integral_constant {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; #endif @@ -2634,7 +2630,7 @@ template struct __select_2nd { typedef _LIBCPP_NODEBUG _ template struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); #endif @@ -2663,7 +2659,7 @@ template struct is_assignable : public __is_assignable_imp<_Tp, _Arg> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_assignable_v = is_assignable<_Tp, _Arg>::value; #endif @@ -2676,7 +2672,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_copy_assignable : public is_assignable::type, typename add_lvalue_reference::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; #endif @@ -2687,7 +2683,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_move_assignable : public is_assignable::type, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; #endif @@ -2699,7 +2695,7 @@ inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_destructible_v = __is_destructible(_Tp); #endif @@ -2762,7 +2758,7 @@ template <> struct is_destructible : public false_type {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; #endif @@ -3005,7 +3001,7 @@ struct _LIBCPP_TEMPLATE_VIS is_constructible : public integral_constant { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value; #endif @@ -3017,7 +3013,7 @@ struct _LIBCPP_TEMPLATE_VIS is_default_constructible : public is_constructible<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value; #endif @@ -3053,7 +3049,7 @@ struct _LIBCPP_TEMPLATE_VIS is_copy_constructible : public is_constructible<_Tp, typename add_lvalue_reference::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; #endif @@ -3065,7 +3061,7 @@ struct _LIBCPP_TEMPLATE_VIS is_move_constructible : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; #endif @@ -3078,7 +3074,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value; #endif @@ -3089,7 +3085,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructi : public is_trivially_constructible<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value; #endif @@ -3100,7 +3096,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible : public is_trivially_constructible<_Tp, typename add_lvalue_reference::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<_Tp>::value; #endif @@ -3111,7 +3107,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<_Tp>::value; #endif @@ -3123,7 +3119,7 @@ struct is_trivially_assignable : integral_constant { }; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value; #endif @@ -3134,7 +3130,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable : public is_trivially_assignable::type, typename add_lvalue_reference::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<_Tp>::value; #endif @@ -3146,7 +3142,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<_Tp>::value; #endif @@ -3177,7 +3173,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible<_Tp[] #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; #endif @@ -3230,7 +3226,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> #endif // _LIBCPP_HAS_NO_NOEXCEPT -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; #endif @@ -3241,7 +3237,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructibl : public is_nothrow_constructible<_Tp> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value; #endif @@ -3252,7 +3248,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible : public is_nothrow_constructible<_Tp, typename add_lvalue_reference::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; #endif @@ -3263,7 +3259,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; #endif @@ -3300,7 +3296,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable #endif // _LIBCPP_HAS_NO_NOEXCEPT -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value; #endif @@ -3311,7 +3307,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable : public is_nothrow_assignable::type, typename add_lvalue_reference::type>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value; #endif @@ -3323,7 +3319,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable typename add_rvalue_reference<_Tp>::type> {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value; #endif @@ -3385,7 +3381,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; #endif @@ -3407,7 +3403,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_pod #endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_pod_v = is_pod<_Tp>::value; #endif @@ -3419,10 +3415,10 @@ template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_ : public integral_constant {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template _LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; -#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#endif // _LIBCPP_STD_VER > 14 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) // is_standard_layout; @@ -3435,7 +3431,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_standard_layout #endif {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; #endif @@ -3446,7 +3442,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable : public integral_constant {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; #endif @@ -3462,7 +3458,7 @@ template struct _LIBCPP_TEMPLATE_VIS is_trivial #endif {}; -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +#if _LIBCPP_STD_VER > 14 template inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; #endif diff --git a/libcxx/test/libcxx/selftest/test_macros.pass.cpp b/libcxx/test/libcxx/selftest/test_macros.pass.cpp index e4dd281..caa31ba 100644 --- a/libcxx/test/libcxx/selftest/test_macros.pass.cpp +++ b/libcxx/test/libcxx/selftest/test_macros.pass.cpp @@ -30,28 +30,9 @@ void test_noexcept() TEST_NOEXCEPT { } -void test_libcxx_macros() -{ -// ===== C++14 features ===== - -// defined(TEST_HAS_VARIABLE_TEMPLATES) != defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) -#ifdef TEST_HAS_VARIABLE_TEMPLATES -# ifdef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -# error "TEST_VARIABLE_TEMPLATES mismatch (1)" -# endif -#else -# ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -# error "TEST_VARIABLE_TEMPLATES mismatch (2)" -# endif -#endif - -// ===== C++17 features ===== -} - int main(int, char**) { test_noexcept(); - test_libcxx_macros(); - return 0; + return 0; } diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index a7ff518..08511fa 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -163,20 +163,6 @@ # define TEST_CONSTEXPR_CXX20 #endif -/* Features that were introduced in C++14 */ -#if TEST_STD_VER >= 14 -#define TEST_HAS_VARIABLE_TEMPLATES -#endif - -/* Features that were introduced in C++17 */ -#if TEST_STD_VER >= 17 -#endif - -/* Features that were introduced after C++17 */ -#if TEST_STD_VER > 17 -#endif - - #define TEST_ALIGNAS_TYPE(...) TEST_ALIGNAS(TEST_ALIGNOF(__VA_ARGS__)) #if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cpp_rtti) \ -- 2.7.4