diff --git a/libcxx/include/__compare/compare_three_way_result.h b/libcxx/include/__compare/compare_three_way_result.h index d7508073433af..6ee2eff00302d 100644 --- a/libcxx/include/__compare/compare_three_way_result.h +++ b/libcxx/include/__compare/compare_three_way_result.h @@ -33,7 +33,8 @@ struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result< }; template -struct _LIBCPP_TEMPLATE_VIS compare_three_way_result : __compare_three_way_result<_Tp, _Up, void> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS compare_three_way_result + : __compare_three_way_result<_Tp, _Up, void> {}; template using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type; diff --git a/libcxx/include/__config b/libcxx/include/__config index 5d5c90d7b87a7..5a0d22588d6da 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1168,6 +1168,13 @@ typedef __char32_t char32_t; # define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]] +# if __has_cpp_attribute(_Clang::__no_specializations__) +# define _LIBCPP_NO_SPECIALIZATIONS \ + [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]] +# else +# define _LIBCPP_NO_SPECIALIZATIONS +# endif + # if __has_attribute(__standalone_debug__) # define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) # else diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h index 1c530fd5a5d03..10f0ba9928ce7 100644 --- a/libcxx/include/__format/format_arg.h +++ b/libcxx/include/__format/format_arg.h @@ -277,7 +277,7 @@ class __basic_format_arg_value { }; template -class _LIBCPP_TEMPLATE_VIS basic_format_arg { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS basic_format_arg { public: class _LIBCPP_TEMPLATE_VIS handle; diff --git a/libcxx/include/__ranges/range_adaptor.h b/libcxx/include/__ranges/range_adaptor.h index d944a83406ba7..4bcb53e1a5846 100644 --- a/libcxx/include/__ranges/range_adaptor.h +++ b/libcxx/include/__ranges/range_adaptor.h @@ -85,7 +85,7 @@ template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure> # if _LIBCPP_STD_VER >= 23 template requires is_class_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>> -class range_adaptor_closure : public __range_adaptor_closure<_Tp> {}; +class _LIBCPP_NO_SPECIALIZATIONS range_adaptor_closure : public __range_adaptor_closure<_Tp> {}; # endif // _LIBCPP_STD_VER >= 23 } // namespace ranges diff --git a/libcxx/include/__type_traits/add_cv_quals.h b/libcxx/include/__type_traits/add_cv_quals.h index 6f671397622ad..3fbc8d935d26c 100644 --- a/libcxx/include/__type_traits/add_cv_quals.h +++ b/libcxx/include/__type_traits/add_cv_quals.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS add_const { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS add_const { using type _LIBCPP_NODEBUG = const _Tp; }; @@ -28,7 +28,7 @@ using add_const_t = typename add_const<_Tp>::type; #endif template -struct _LIBCPP_TEMPLATE_VIS add_cv { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS add_cv { using type _LIBCPP_NODEBUG = const volatile _Tp; }; @@ -38,7 +38,7 @@ using add_cv_t = typename add_cv<_Tp>::type; #endif template -struct _LIBCPP_TEMPLATE_VIS add_volatile { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS add_volatile { using type _LIBCPP_NODEBUG = volatile _Tp; }; diff --git a/libcxx/include/__type_traits/add_lvalue_reference.h b/libcxx/include/__type_traits/add_lvalue_reference.h index b1ee6ed73c8ac..f861420a10e05 100644 --- a/libcxx/include/__type_traits/add_lvalue_reference.h +++ b/libcxx/include/__type_traits/add_lvalue_reference.h @@ -40,7 +40,7 @@ using __add_lvalue_reference_t = typename __add_lvalue_reference_impl<_Tp>::type #endif // __has_builtin(__add_lvalue_reference) template -struct add_lvalue_reference { +struct _LIBCPP_NO_SPECIALIZATIONS add_lvalue_reference { using type _LIBCPP_NODEBUG = __add_lvalue_reference_t<_Tp>; }; diff --git a/libcxx/include/__type_traits/add_pointer.h b/libcxx/include/__type_traits/add_pointer.h index b53d8eae708e2..d10b5cf70c64d 100644 --- a/libcxx/include/__type_traits/add_pointer.h +++ b/libcxx/include/__type_traits/add_pointer.h @@ -41,7 +41,7 @@ using __add_pointer_t = typename __add_pointer_impl<_Tp>::type; #endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) template -struct add_pointer { +struct _LIBCPP_NO_SPECIALIZATIONS add_pointer { using type _LIBCPP_NODEBUG = __add_pointer_t<_Tp>; }; diff --git a/libcxx/include/__type_traits/add_rvalue_reference.h b/libcxx/include/__type_traits/add_rvalue_reference.h index d844ccc1f539d..ed4f8633bce1f 100644 --- a/libcxx/include/__type_traits/add_rvalue_reference.h +++ b/libcxx/include/__type_traits/add_rvalue_reference.h @@ -40,7 +40,7 @@ using __add_rvalue_reference_t = typename __add_rvalue_reference_impl<_Tp>::type #endif // __has_builtin(__add_rvalue_reference) template -struct add_rvalue_reference { +struct _LIBCPP_NO_SPECIALIZATIONS add_rvalue_reference { using type = __add_rvalue_reference_t<_Tp>; }; diff --git a/libcxx/include/__type_traits/aligned_storage.h b/libcxx/include/__type_traits/aligned_storage.h index d98749980122e..def785de2cb52 100644 --- a/libcxx/include/__type_traits/aligned_storage.h +++ b/libcxx/include/__type_traits/aligned_storage.h @@ -69,7 +69,7 @@ struct __find_max_align<__type_list<_Head, _Tail...>, _Len> __select_align<_Len, _Head::value, __find_max_align<__type_list<_Tail...>, _Len>::value>::value> {}; template ::value> -struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage { +struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS aligned_storage { union _ALIGNAS(_Align) type { unsigned char __data[(_Len + _Align - 1) / _Align * _Align]; }; diff --git a/libcxx/include/__type_traits/aligned_union.h b/libcxx/include/__type_traits/aligned_union.h index de62a4b1c2a33..dd88d54f5979b 100644 --- a/libcxx/include/__type_traits/aligned_union.h +++ b/libcxx/include/__type_traits/aligned_union.h @@ -34,7 +34,7 @@ struct __static_max<_I0, _I1, _In...> { }; template -struct _LIBCPP_DEPRECATED_IN_CXX23 aligned_union { +struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_NO_SPECIALIZATIONS aligned_union { static const size_t alignment_value = __static_max<_LIBCPP_PREFERRED_ALIGNOF(_Type0), _LIBCPP_PREFERRED_ALIGNOF(_Types)...>::value; static const size_t __len = __static_max<_Len, sizeof(_Type0), sizeof(_Types)...>::value; diff --git a/libcxx/include/__type_traits/alignment_of.h b/libcxx/include/__type_traits/alignment_of.h index 8871c8ce110d6..9801cac2cadd2 100644 --- a/libcxx/include/__type_traits/alignment_of.h +++ b/libcxx/include/__type_traits/alignment_of.h @@ -20,11 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS alignment_of : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS alignment_of + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr size_t alignment_of_v = _LIBCPP_ALIGNOF(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr size_t alignment_of_v = _LIBCPP_ALIGNOF(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/conditional.h b/libcxx/include/__type_traits/conditional.h index 5b5445a837427..20460c7f2e39c 100644 --- a/libcxx/include/__type_traits/conditional.h +++ b/libcxx/include/__type_traits/conditional.h @@ -36,13 +36,19 @@ template using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>; template -struct _LIBCPP_TEMPLATE_VIS conditional { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS conditional { using type _LIBCPP_NODEBUG = _If; }; + +_LIBCPP_DIAGNOSTIC_PUSH +#if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +#endif template struct _LIBCPP_TEMPLATE_VIS conditional { using type _LIBCPP_NODEBUG = _Then; }; +_LIBCPP_DIAGNOSTIC_POP #if _LIBCPP_STD_VER >= 14 template diff --git a/libcxx/include/__type_traits/conjunction.h b/libcxx/include/__type_traits/conjunction.h index 4001d6c12d5df..ad9656acd47ec 100644 --- a/libcxx/include/__type_traits/conjunction.h +++ b/libcxx/include/__type_traits/conjunction.h @@ -47,16 +47,21 @@ struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)... #if _LIBCPP_STD_VER >= 17 template -struct conjunction : true_type {}; +struct _LIBCPP_NO_SPECIALIZATIONS conjunction : true_type {}; +_LIBCPP_DIAGNOSTIC_PUSH +# if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +# endif template struct conjunction<_Arg> : _Arg {}; template struct conjunction<_Arg, _Args...> : conditional_t> {}; +_LIBCPP_DIAGNOSTIC_POP template -inline constexpr bool conjunction_v = conjunction<_Args...>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool conjunction_v = conjunction<_Args...>::value; #endif // _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h index da0c4d340e9bb..2fd73d3dde45d 100644 --- a/libcxx/include/__type_traits/decay.h +++ b/libcxx/include/__type_traits/decay.h @@ -30,7 +30,7 @@ template using __decay_t _LIBCPP_NODEBUG = __decay(_Tp); template -struct decay { +struct _LIBCPP_NO_SPECIALIZATIONS decay { using type _LIBCPP_NODEBUG = __decay_t<_Tp>; }; diff --git a/libcxx/include/__type_traits/disjunction.h b/libcxx/include/__type_traits/disjunction.h index d579de9b98439..8e7a38413a985 100644 --- a/libcxx/include/__type_traits/disjunction.h +++ b/libcxx/include/__type_traits/disjunction.h @@ -46,10 +46,10 @@ using _Or _LIBCPP_NODEBUG = typename _OrImpl::template _R #if _LIBCPP_STD_VER >= 17 template -struct disjunction : _Or<_Args...> {}; +struct _LIBCPP_NO_SPECIALIZATIONS disjunction : _Or<_Args...> {}; template -inline constexpr bool disjunction_v = _Or<_Args...>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool disjunction_v = _Or<_Args...>::value; #endif // _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/__type_traits/enable_if.h b/libcxx/include/__type_traits/enable_if.h index 77da9622ca28f..b572092542d4a 100644 --- a/libcxx/include/__type_traits/enable_if.h +++ b/libcxx/include/__type_traits/enable_if.h @@ -18,11 +18,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS enable_if {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS enable_if{}; + +_LIBCPP_DIAGNOSTIC_PUSH +#if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +#endif template struct _LIBCPP_TEMPLATE_VIS enable_if { typedef _Tp type; }; +_LIBCPP_DIAGNOSTIC_POP template using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type; diff --git a/libcxx/include/__type_traits/extent.h b/libcxx/include/__type_traits/extent.h index 1c34a4db1c4b5..6f3db916f96dc 100644 --- a/libcxx/include/__type_traits/extent.h +++ b/libcxx/include/__type_traits/extent.h @@ -22,11 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__array_extent) template -struct _LIBCPP_TEMPLATE_VIS extent : integral_constant {}; +struct _LIBCPP_NO_SPECIALIZATIONS _LIBCPP_TEMPLATE_VIS extent : integral_constant {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); # endif #else // __has_builtin(__array_extent) diff --git a/libcxx/include/__type_traits/has_unique_object_representation.h b/libcxx/include/__type_traits/has_unique_object_representation.h index 98c440c16bf26..d92fef0b5d2ba 100644 --- a/libcxx/include/__type_traits/has_unique_object_representation.h +++ b/libcxx/include/__type_traits/has_unique_object_representation.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 17 template -struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS has_unique_object_representations // TODO: We work around a Clang and GCC bug in __has_unique_object_representations by using remove_all_extents // even though it should not be necessary. This was reported to the compilers: // - Clang: https://github.com/llvm/llvm-project/issues/95311 @@ -31,7 +31,8 @@ struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations : public integral_constant)> {}; template -inline constexpr bool has_unique_object_representations_v = __has_unique_object_representations(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool has_unique_object_representations_v = + __has_unique_object_representations(_Tp); #endif diff --git a/libcxx/include/__type_traits/has_virtual_destructor.h b/libcxx/include/__type_traits/has_virtual_destructor.h index 4ce96e649e67a..98fa3cf692398 100644 --- a/libcxx/include/__type_traits/has_virtual_destructor.h +++ b/libcxx/include/__type_traits/has_virtual_destructor.h @@ -19,11 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS has_virtual_destructor + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/integral_constant.h b/libcxx/include/__type_traits/integral_constant.h index b8c75c546aa94..8feeff630d874 100644 --- a/libcxx/include/__type_traits/integral_constant.h +++ b/libcxx/include/__type_traits/integral_constant.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS integral_constant { +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS integral_constant { static inline _LIBCPP_CONSTEXPR const _Tp value = __v; typedef _Tp value_type; typedef integral_constant type; diff --git a/libcxx/include/__type_traits/invoke.h b/libcxx/include/__type_traits/invoke.h index 013293bec49b9..ba4d539ee20b0 100644 --- a/libcxx/include/__type_traits/invoke.h +++ b/libcxx/include/__type_traits/invoke.h @@ -278,34 +278,37 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Ret __invoke_r(_Args&&... _ // is_invocable template -struct _LIBCPP_TEMPLATE_VIS is_invocable : bool_constant<__is_invocable_v<_Fn, _Args...>> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_invocable : bool_constant<__is_invocable_v<_Fn, _Args...>> {}; template -struct _LIBCPP_TEMPLATE_VIS is_invocable_r : bool_constant<__is_invocable_r_v<_Ret, _Fn, _Args...>> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_invocable_r + : bool_constant<__is_invocable_r_v<_Ret, _Fn, _Args...>> {}; template -inline constexpr bool is_invocable_v = __is_invocable_v<_Fn, _Args...>; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_invocable_v = __is_invocable_v<_Fn, _Args...>; template -inline constexpr bool is_invocable_r_v = __is_invocable_r_v<_Ret, _Fn, _Args...>; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_invocable_r_v = __is_invocable_r_v<_Ret, _Fn, _Args...>; // is_nothrow_invocable template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable : bool_constant<__nothrow_invokable<_Fn, _Args...>::value> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_invocable + : bool_constant<__nothrow_invokable<_Fn, _Args...>::value> {}; template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r : bool_constant<__nothrow_invokable_r<_Ret, _Fn, _Args...>::value> { -}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_invocable_r + : bool_constant<__nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {}; template -inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value; template -inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_invocable_r_v = + is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; template -struct _LIBCPP_TEMPLATE_VIS invoke_result : __invoke_result<_Fn, _Args...> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS invoke_result : __invoke_result<_Fn, _Args...> {}; template using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; diff --git a/libcxx/include/__type_traits/is_abstract.h b/libcxx/include/__type_traits/is_abstract.h index 4aa456be1c48e..20b9e56cd60eb 100644 --- a/libcxx/include/__type_traits/is_abstract.h +++ b/libcxx/include/__type_traits/is_abstract.h @@ -19,11 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_abstract : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_abstract + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_abstract_v = __is_abstract(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_abstract_v = __is_abstract(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_aggregate.h b/libcxx/include/__type_traits/is_aggregate.h index 4e0988071adee..b5098ee1bcf1a 100644 --- a/libcxx/include/__type_traits/is_aggregate.h +++ b/libcxx/include/__type_traits/is_aggregate.h @@ -21,10 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 17 template -struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_aggregate + : public integral_constant {}; template -inline constexpr bool is_aggregate_v = __is_aggregate(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_aggregate_v = __is_aggregate(_Tp); #endif // _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/__type_traits/is_arithmetic.h b/libcxx/include/__type_traits/is_arithmetic.h index c9713e1840a7b..fcb31e9f5d5da 100644 --- a/libcxx/include/__type_traits/is_arithmetic.h +++ b/libcxx/include/__type_traits/is_arithmetic.h @@ -21,12 +21,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_arithmetic +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_arithmetic : public integral_constant::value || is_floating_point<_Tp>::value> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_array.h b/libcxx/include/__type_traits/is_array.h index f34204e19ed89..0bde0aa970f88 100644 --- a/libcxx/include/__type_traits/is_array.h +++ b/libcxx/include/__type_traits/is_array.h @@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD (!defined(_LIBCPP_COMPILER_CLANG_BASED) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1900)) template -struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_array : _BoolConstant<__is_array(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_array_v = __is_array(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_array_v = __is_array(_Tp); # endif #else diff --git a/libcxx/include/__type_traits/is_assignable.h b/libcxx/include/__type_traits/is_assignable.h index cfb4699777878..2a87bcc673e51 100644 --- a/libcxx/include/__type_traits/is_assignable.h +++ b/libcxx/include/__type_traits/is_assignable.h @@ -21,30 +21,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); #endif template -struct _LIBCPP_TEMPLATE_VIS is_copy_assignable +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_copy_assignable : public integral_constant, __add_lvalue_reference_t)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_move_assignable +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_move_assignable : public integral_constant, __add_rvalue_reference_t<_Tp>)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_base_of.h b/libcxx/include/__type_traits/is_base_of.h index 488b63719eb60..a48b8caded721 100644 --- a/libcxx/include/__type_traits/is_base_of.h +++ b/libcxx/include/__type_traits/is_base_of.h @@ -19,21 +19,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_base_of : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_base_of + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_base_of_v = __is_base_of(_Bp, _Dp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_base_of_v = __is_base_of(_Bp, _Dp); #endif #if _LIBCPP_STD_VER >= 26 # if __has_builtin(__builtin_is_virtual_base_of) template -struct _LIBCPP_TEMPLATE_VIS is_virtual_base_of : public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_virtual_base_of + : public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)> {}; template -inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived); # endif #endif diff --git a/libcxx/include/__type_traits/is_bounded_array.h b/libcxx/include/__type_traits/is_bounded_array.h index fd794eb9a6935..a853cc6d821ed 100644 --- a/libcxx/include/__type_traits/is_bounded_array.h +++ b/libcxx/include/__type_traits/is_bounded_array.h @@ -27,12 +27,18 @@ inline const bool __is_bounded_array_v<_Tp[_Np]> = true; #if _LIBCPP_STD_VER >= 20 template -struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_bounded_array : false_type {}; + +_LIBCPP_DIAGNOSTIC_PUSH +# if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +# endif template struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {}; +_LIBCPP_DIAGNOSTIC_POP template -inline constexpr bool is_bounded_array_v = is_bounded_array<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_bounded_array_v = is_bounded_array<_Tp>::value; #endif diff --git a/libcxx/include/__type_traits/is_class.h b/libcxx/include/__type_traits/is_class.h index 034f76a7865e3..5fce840058c05 100644 --- a/libcxx/include/__type_traits/is_class.h +++ b/libcxx/include/__type_traits/is_class.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_class : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_class : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_class_v = __is_class(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_class_v = __is_class(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_compound.h b/libcxx/include/__type_traits/is_compound.h index cd208ceab2886..6dc22f8a91116 100644 --- a/libcxx/include/__type_traits/is_compound.h +++ b/libcxx/include/__type_traits/is_compound.h @@ -22,11 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_compound) template -struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_compound : _BoolConstant<__is_compound(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_compound_v = __is_compound(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_compound_v = __is_compound(_Tp); # endif #else // __has_builtin(__is_compound) diff --git a/libcxx/include/__type_traits/is_const.h b/libcxx/include/__type_traits/is_const.h index 47ef70872b790..78f98f3a96d4f 100644 --- a/libcxx/include/__type_traits/is_const.h +++ b/libcxx/include/__type_traits/is_const.h @@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_const) template -struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_const : _BoolConstant<__is_const(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_const_v = __is_const(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_const_v = __is_const(_Tp); # endif #else diff --git a/libcxx/include/__type_traits/is_constructible.h b/libcxx/include/__type_traits/is_constructible.h index 567bd165c7152..6c7636e0bb509 100644 --- a/libcxx/include/__type_traits/is_constructible.h +++ b/libcxx/include/__type_traits/is_constructible.h @@ -21,37 +21,39 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_constructible : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_constructible + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); #endif template -struct _LIBCPP_TEMPLATE_VIS is_copy_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_copy_constructible : public integral_constant)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_move_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_move_constructible : public integral_constant)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_default_constructible : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_default_constructible + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_default_constructible_v = __is_constructible(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_default_constructible_v = __is_constructible(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_convertible.h b/libcxx/include/__type_traits/is_convertible.h index 414c2a6d6a0de..61f6cf644124e 100644 --- a/libcxx/include/__type_traits/is_convertible.h +++ b/libcxx/include/__type_traits/is_convertible.h @@ -19,11 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_convertible + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_convertible_v = __is_convertible(_From, _To); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_convertible_v = __is_convertible(_From, _To); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_destructible.h b/libcxx/include/__type_traits/is_destructible.h index 3248b07d36ee6..5fe923d303c53 100644 --- a/libcxx/include/__type_traits/is_destructible.h +++ b/libcxx/include/__type_traits/is_destructible.h @@ -25,11 +25,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_destructible) template -struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_destructible : _BoolConstant<__is_destructible(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_destructible_v = __is_destructible(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_destructible_v = __is_destructible(_Tp); # endif #else // __has_builtin(__is_destructible) diff --git a/libcxx/include/__type_traits/is_empty.h b/libcxx/include/__type_traits/is_empty.h index 951d93b5a2f10..8e66cd97a9f28 100644 --- a/libcxx/include/__type_traits/is_empty.h +++ b/libcxx/include/__type_traits/is_empty.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_empty : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_empty : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_empty_v = __is_empty(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_empty_v = __is_empty(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_enum.h b/libcxx/include/__type_traits/is_enum.h index 2fab6db2c8d50..bc210ea289e62 100644 --- a/libcxx/include/__type_traits/is_enum.h +++ b/libcxx/include/__type_traits/is_enum.h @@ -19,20 +19,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_enum : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_enum_v = __is_enum(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_enum_v = __is_enum(_Tp); #endif #if _LIBCPP_STD_VER >= 23 template -struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_scoped_enum : bool_constant<__is_scoped_enum(_Tp)> {}; template -inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp); #endif // _LIBCPP_STD_VER >= 23 diff --git a/libcxx/include/__type_traits/is_execution_policy.h b/libcxx/include/__type_traits/is_execution_policy.h index a2d876db03092..84393e83a8efc 100644 --- a/libcxx/include/__type_traits/is_execution_policy.h +++ b/libcxx/include/__type_traits/is_execution_policy.h @@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -inline constexpr bool is_execution_policy_v = false; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_execution_policy_v = false; template inline constexpr bool __is_unsequenced_execution_policy_impl = false; diff --git a/libcxx/include/__type_traits/is_final.h b/libcxx/include/__type_traits/is_final.h index 499c5e3a1edca..19d3ac3ecd35f 100644 --- a/libcxx/include/__type_traits/is_final.h +++ b/libcxx/include/__type_traits/is_final.h @@ -23,12 +23,12 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_is_final : public integral_constant= 14 template -struct _LIBCPP_TEMPLATE_VIS is_final : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_final : public integral_constant {}; #endif #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_final_v = __is_final(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_final_v = __is_final(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_floating_point.h b/libcxx/include/__type_traits/is_floating_point.h index add34782dfa09..563ecce891f22 100644 --- a/libcxx/include/__type_traits/is_floating_point.h +++ b/libcxx/include/__type_traits/is_floating_point.h @@ -27,11 +27,12 @@ template <> struct __libcpp_is_floating_point : public tru // clang-format on template -struct _LIBCPP_TEMPLATE_VIS is_floating_point : public __libcpp_is_floating_point<__remove_cv_t<_Tp> > {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_floating_point + : public __libcpp_is_floating_point<__remove_cv_t<_Tp> > {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_function.h b/libcxx/include/__type_traits/is_function.h index 98fedd0ad96d9..63b842b26c4ce 100644 --- a/libcxx/include/__type_traits/is_function.h +++ b/libcxx/include/__type_traits/is_function.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_function : integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_function_v = __is_function(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_function_v = __is_function(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_fundamental.h b/libcxx/include/__type_traits/is_fundamental.h index 55f8e41f75f45..03e25474bea77 100644 --- a/libcxx/include/__type_traits/is_fundamental.h +++ b/libcxx/include/__type_traits/is_fundamental.h @@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_fundamental) template -struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); # endif #else // __has_builtin(__is_fundamental) diff --git a/libcxx/include/__type_traits/is_implicit_lifetime.h b/libcxx/include/__type_traits/is_implicit_lifetime.h index 2aba420bd2b59..8b992095f105b 100644 --- a/libcxx/include/__type_traits/is_implicit_lifetime.h +++ b/libcxx/include/__type_traits/is_implicit_lifetime.h @@ -22,10 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD # if __has_builtin(__builtin_is_implicit_lifetime) template -struct _LIBCPP_TEMPLATE_VIS is_implicit_lifetime : public bool_constant<__builtin_is_implicit_lifetime(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_implicit_lifetime + : public bool_constant<__builtin_is_implicit_lifetime(_Tp)> {}; template -inline constexpr bool is_implicit_lifetime_v = __builtin_is_implicit_lifetime(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_implicit_lifetime_v = __builtin_is_implicit_lifetime(_Tp); # endif #endif diff --git a/libcxx/include/__type_traits/is_integral.h b/libcxx/include/__type_traits/is_integral.h index 763b6ac3d1077..6ae9b31a8e9b6 100644 --- a/libcxx/include/__type_traits/is_integral.h +++ b/libcxx/include/__type_traits/is_integral.h @@ -50,11 +50,11 @@ template <> struct __libcpp_is_integral<__uint128_t> { enum { va #if __has_builtin(__is_integral) template -struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_integral : _BoolConstant<__is_integral(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_integral_v = __is_integral(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_integral_v = __is_integral(_Tp); # endif #else diff --git a/libcxx/include/__type_traits/is_literal_type.h b/libcxx/include/__type_traits/is_literal_type.h index 10e23bceffbda..e78343ee2f0be 100644 --- a/libcxx/include/__type_traits/is_literal_type.h +++ b/libcxx/include/__type_traits/is_literal_type.h @@ -20,12 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) template -struct _LIBCPP_TEMPLATE_VIS -_LIBCPP_DEPRECATED_IN_CXX17 is_literal_type : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type + : public integral_constant {}; # if _LIBCPP_STD_VER >= 17 template -_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); +_LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); # endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) diff --git a/libcxx/include/__type_traits/is_member_pointer.h b/libcxx/include/__type_traits/is_member_pointer.h index 3e2753ac4228c..8a4f1fe0c736f 100644 --- a/libcxx/include/__type_traits/is_member_pointer.h +++ b/libcxx/include/__type_traits/is_member_pointer.h @@ -19,23 +19,25 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> {}; template -struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_member_object_pointer + : _BoolConstant<__is_member_object_pointer(_Tp)> {}; template -struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_member_function_pointer + : _BoolConstant<__is_member_function_pointer(_Tp)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); template -inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); template -inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_nothrow_assignable.h b/libcxx/include/__type_traits/is_nothrow_assignable.h index 7e00c741f83e3..4727deb6c3f85 100644 --- a/libcxx/include/__type_traits/is_nothrow_assignable.h +++ b/libcxx/include/__type_traits/is_nothrow_assignable.h @@ -21,34 +21,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable : public integral_constant { -}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_assignable + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_Tp, _Arg); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_Tp, _Arg); #endif template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_copy_assignable : public integral_constant< bool, __is_nothrow_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_move_assignable : public integral_constant, __add_rvalue_reference_t<_Tp>)> { }; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_nothrow_constructible.h b/libcxx/include/__type_traits/is_nothrow_constructible.h index 58d2b2475140b..1e4eebd006ec1 100644 --- a/libcxx/include/__type_traits/is_nothrow_constructible.h +++ b/libcxx/include/__type_traits/is_nothrow_constructible.h @@ -21,39 +21,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD template < class _Tp, class... _Args> -struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_constructible : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_constructible_v = + is_nothrow_constructible<_Tp, _Args...>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_copy_constructible : public integral_constant< bool, __is_nothrow_constructible(_Tp, __add_lvalue_reference_t)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_copy_constructible_v = + is_nothrow_copy_constructible<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_move_constructible : public integral_constant)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_move_constructible_v = + is_nothrow_move_constructible<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_default_constructible : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_nothrow_convertible.h b/libcxx/include/__type_traits/is_nothrow_convertible.h index bfc5a94cbadec..8b1aacf8f2876 100644 --- a/libcxx/include/__type_traits/is_nothrow_convertible.h +++ b/libcxx/include/__type_traits/is_nothrow_convertible.h @@ -29,10 +29,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD # if __has_builtin(__is_nothrow_convertible) template -struct is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {}; +struct _LIBCPP_NO_SPECIALIZATIONS is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {}; template -inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_convertible_v = __is_nothrow_convertible(_Tp, _Up); # else // __has_builtin(__is_nothrow_convertible) diff --git a/libcxx/include/__type_traits/is_nothrow_destructible.h b/libcxx/include/__type_traits/is_nothrow_destructible.h index 41271a38f3711..a363ad6b4af3b 100644 --- a/libcxx/include/__type_traits/is_nothrow_destructible.h +++ b/libcxx/include/__type_traits/is_nothrow_destructible.h @@ -24,7 +24,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_nothrow_destructible) template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible : integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_destructible + : integral_constant {}; #else @@ -55,7 +56,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&> : public true_type {} #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_null_pointer.h b/libcxx/include/__type_traits/is_null_pointer.h index abc5d142562f1..fc6c6a69de338 100644 --- a/libcxx/include/__type_traits/is_null_pointer.h +++ b/libcxx/include/__type_traits/is_null_pointer.h @@ -24,11 +24,12 @@ inline const bool __is_null_pointer_v = __is_same(__remove_cv(_Tp), nullptr_t); #if _LIBCPP_STD_VER >= 14 template -struct _LIBCPP_TEMPLATE_VIS is_null_pointer : integral_constant> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_null_pointer + : integral_constant> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_null_pointer_v = __is_null_pointer_v<_Tp>; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_null_pointer_v = __is_null_pointer_v<_Tp>; # endif #endif // _LIBCPP_STD_VER >= 14 diff --git a/libcxx/include/__type_traits/is_object.h b/libcxx/include/__type_traits/is_object.h index ec04508402ce5..eba4ab5cb8806 100644 --- a/libcxx/include/__type_traits/is_object.h +++ b/libcxx/include/__type_traits/is_object.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_object : _BoolConstant<__is_object(_Tp)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_object_v = __is_object(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_object_v = __is_object(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_pod.h b/libcxx/include/__type_traits/is_pod.h index 5888fbf457d8b..a57662400394a 100644 --- a/libcxx/include/__type_traits/is_pod.h +++ b/libcxx/include/__type_traits/is_pod.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_pod : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_pod_v = __is_pod(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_pod_v = __is_pod(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_pointer.h b/libcxx/include/__type_traits/is_pointer.h index 9701e57807cf6..5647bf4045ff3 100644 --- a/libcxx/include/__type_traits/is_pointer.h +++ b/libcxx/include/__type_traits/is_pointer.h @@ -22,11 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_pointer) template -struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pointer : _BoolConstant<__is_pointer(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_pointer_v = __is_pointer(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_pointer_v = __is_pointer(_Tp); # endif #else // __has_builtin(__is_pointer) diff --git a/libcxx/include/__type_traits/is_polymorphic.h b/libcxx/include/__type_traits/is_polymorphic.h index d122e1c87775b..17e9c21c0d6a1 100644 --- a/libcxx/include/__type_traits/is_polymorphic.h +++ b/libcxx/include/__type_traits/is_polymorphic.h @@ -19,11 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_polymorphic : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_polymorphic + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_polymorphic_v = __is_polymorphic(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_polymorphic_v = __is_polymorphic(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_reference.h b/libcxx/include/__type_traits/is_reference.h index cc157a438e491..564e888b77c13 100644 --- a/libcxx/include/__type_traits/is_reference.h +++ b/libcxx/include/__type_traits/is_reference.h @@ -19,26 +19,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_reference : _BoolConstant<__is_reference(_Tp)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_reference_v = __is_reference(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_reference_v = __is_reference(_Tp); #endif #if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference) template -struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { +}; template -struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> { +}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp); template -inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp); # endif #else // __has_builtin(__is_lvalue_reference) diff --git a/libcxx/include/__type_traits/is_same.h b/libcxx/include/__type_traits/is_same.h index 400f870904d2d..befab8999ae26 100644 --- a/libcxx/include/__type_traits/is_same.h +++ b/libcxx/include/__type_traits/is_same.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_same : _BoolConstant<__is_same(_Tp, _Up)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_same_v = __is_same(_Tp, _Up); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_same_v = __is_same(_Tp, _Up); #endif // _IsSame has the same effect as is_same but instantiates fewer types: diff --git a/libcxx/include/__type_traits/is_scalar.h b/libcxx/include/__type_traits/is_scalar.h index 242023a6877c9..6ef57e1dd22d5 100644 --- a/libcxx/include/__type_traits/is_scalar.h +++ b/libcxx/include/__type_traits/is_scalar.h @@ -26,11 +26,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_scalar) template -struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_scalar : _BoolConstant<__is_scalar(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_scalar_v = __is_scalar(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_scalar_v = __is_scalar(_Tp); # endif #else // __has_builtin(__is_scalar) diff --git a/libcxx/include/__type_traits/is_signed.h b/libcxx/include/__type_traits/is_signed.h index fd6f93e182362..535324fdbfc14 100644 --- a/libcxx/include/__type_traits/is_signed.h +++ b/libcxx/include/__type_traits/is_signed.h @@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_signed) template -struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_signed : _BoolConstant<__is_signed(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_signed_v = __is_signed(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_signed_v = __is_signed(_Tp); # endif #else // __has_builtin(__is_signed) diff --git a/libcxx/include/__type_traits/is_standard_layout.h b/libcxx/include/__type_traits/is_standard_layout.h index 76484f3e2a301..e70d0f365416e 100644 --- a/libcxx/include/__type_traits/is_standard_layout.h +++ b/libcxx/include/__type_traits/is_standard_layout.h @@ -19,11 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_standard_layout : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_standard_layout + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h index aa5eecd9abe0f..c7527814cffb9 100644 --- a/libcxx/include/__type_traits/is_swappable.h +++ b/libcxx/include/__type_traits/is_swappable.h @@ -74,30 +74,33 @@ inline const bool __is_nothrow_swappable_with_v<_Tp, _Up, true> = #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_swappable_with_v = __is_swappable_with_v<_Tp, _Up>; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_swappable_with_v = __is_swappable_with_v<_Tp, _Up>; template -struct _LIBCPP_TEMPLATE_VIS is_swappable_with : bool_constant> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_swappable_with + : bool_constant> {}; template -inline constexpr bool is_swappable_v = +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_swappable_v = is_swappable_with_v<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp>>; template -struct _LIBCPP_TEMPLATE_VIS is_swappable : bool_constant> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_swappable : bool_constant> {}; template -inline constexpr bool is_nothrow_swappable_with_v = __is_nothrow_swappable_with_v<_Tp, _Up>; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_swappable_with_v = __is_nothrow_swappable_with_v<_Tp, _Up>; template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with : bool_constant> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_swappable_with + : bool_constant> {}; template -inline constexpr bool is_nothrow_swappable_v = +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable_with_v<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp>>; template -struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable : bool_constant> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_swappable + : bool_constant> {}; #endif // _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/__type_traits/is_trivial.h b/libcxx/include/__type_traits/is_trivial.h index 0007c7446d5e5..a4ca2d6b26d0e 100644 --- a/libcxx/include/__type_traits/is_trivial.h +++ b/libcxx/include/__type_traits/is_trivial.h @@ -19,11 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_trivial : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivial : public integral_constant { +}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivial_v = __is_trivial(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivial_v = __is_trivial(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_assignable.h b/libcxx/include/__type_traits/is_trivially_assignable.h index 7720c3e637506..d91b6d89c7e21 100644 --- a/libcxx/include/__type_traits/is_trivially_assignable.h +++ b/libcxx/include/__type_traits/is_trivially_assignable.h @@ -21,33 +21,36 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct is_trivially_assignable : integral_constant {}; +struct _LIBCPP_NO_SPECIALIZATIONS is_trivially_assignable + : integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_Tp, _Arg); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_Tp, _Arg); #endif template -struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_copy_assignable : public integral_constant< bool, __is_trivially_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_copy_assignable_v = + is_trivially_copy_assignable<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_move_assignable : public integral_constant< bool, __is_trivially_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_move_assignable_v = + is_trivially_move_assignable<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_constructible.h b/libcxx/include/__type_traits/is_trivially_constructible.h index 3a77e9fe164da..4a212d462b63f 100644 --- a/libcxx/include/__type_traits/is_trivially_constructible.h +++ b/libcxx/include/__type_traits/is_trivially_constructible.h @@ -21,39 +21,43 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_constructible : integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_constructible_v = __is_trivially_constructible(_Tp, _Args...); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_constructible_v = + __is_trivially_constructible(_Tp, _Args...); #endif template -struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_copy_constructible : public integral_constant)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_copy_constructible_v = + is_trivially_copy_constructible<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_move_constructible : public integral_constant)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_move_constructible_v = + is_trivially_move_constructible<_Tp>::value; #endif template -struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_default_constructible : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_default_constructible_v = __is_trivially_constructible(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_default_constructible_v = + __is_trivially_constructible(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_trivially_copyable.h b/libcxx/include/__type_traits/is_trivially_copyable.h index 8eb3ba7581af1..72f1d6beae5d4 100644 --- a/libcxx/include/__type_traits/is_trivially_copyable.h +++ b/libcxx/include/__type_traits/is_trivially_copyable.h @@ -20,11 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_copyable + : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); #endif template diff --git a/libcxx/include/__type_traits/is_trivially_destructible.h b/libcxx/include/__type_traits/is_trivially_destructible.h index 5f9652f2a5011..3bca575528e66 100644 --- a/libcxx/include/__type_traits/is_trivially_destructible.h +++ b/libcxx/include/__type_traits/is_trivially_destructible.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_trivially_destructible) template -struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_destructible : public integral_constant {}; #elif __has_builtin(__has_trivial_destructor) @@ -39,7 +39,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_unbounded_array.h b/libcxx/include/__type_traits/is_unbounded_array.h index b0879476bd23e..65a6e1a5276ab 100644 --- a/libcxx/include/__type_traits/is_unbounded_array.h +++ b/libcxx/include/__type_traits/is_unbounded_array.h @@ -26,12 +26,18 @@ inline const bool __is_unbounded_array_v<_Tp[]> = true; #if _LIBCPP_STD_VER >= 20 template -struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_unbounded_array : false_type {}; + +_LIBCPP_DIAGNOSTIC_PUSH +# if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +# endif template struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {}; +_LIBCPP_DIAGNOSTIC_POP template -inline constexpr bool is_unbounded_array_v = is_unbounded_array<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unbounded_array_v = is_unbounded_array<_Tp>::value; #endif diff --git a/libcxx/include/__type_traits/is_union.h b/libcxx/include/__type_traits/is_union.h index 1f009d993545b..4be5ae0118397 100644 --- a/libcxx/include/__type_traits/is_union.h +++ b/libcxx/include/__type_traits/is_union.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_union : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_union : public integral_constant {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_union_v = __is_union(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_union_v = __is_union(_Tp); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_unsigned.h b/libcxx/include/__type_traits/is_unsigned.h index 48c5751ed70d8..be855ee1d7fde 100644 --- a/libcxx/include/__type_traits/is_unsigned.h +++ b/libcxx/include/__type_traits/is_unsigned.h @@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_unsigned) template -struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); # endif #else // __has_builtin(__is_unsigned) diff --git a/libcxx/include/__type_traits/is_void.h b/libcxx/include/__type_traits/is_void.h index 562faae9fba2c..48d73ce49ac5c 100644 --- a/libcxx/include/__type_traits/is_void.h +++ b/libcxx/include/__type_traits/is_void.h @@ -19,11 +19,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_same(__remove_cv(_Tp), void)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_void : _BoolConstant<__is_same(__remove_cv(_Tp), void)> {}; #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_void_v = __is_same(__remove_cv(_Tp), void); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_void_v = __is_same(__remove_cv(_Tp), void); #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/is_volatile.h b/libcxx/include/__type_traits/is_volatile.h index 87960a819c8fc..033d1e3f3b865 100644 --- a/libcxx/include/__type_traits/is_volatile.h +++ b/libcxx/include/__type_traits/is_volatile.h @@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__is_volatile) template -struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_volatile : _BoolConstant<__is_volatile(_Tp)> {}; # if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_volatile_v = __is_volatile(_Tp); +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_volatile_v = __is_volatile(_Tp); # endif #else diff --git a/libcxx/include/__type_traits/make_signed.h b/libcxx/include/__type_traits/make_signed.h index 88513fea3006c..40b9df52fe573 100644 --- a/libcxx/include/__type_traits/make_signed.h +++ b/libcxx/include/__type_traits/make_signed.h @@ -71,7 +71,7 @@ using __make_signed_t = __copy_cv_t<_Tp, typename __make_signed<__remove_cv_t<_T #endif // __has_builtin(__make_signed) template -struct make_signed { +struct _LIBCPP_NO_SPECIALIZATIONS make_signed { using type _LIBCPP_NODEBUG = __make_signed_t<_Tp>; }; diff --git a/libcxx/include/__type_traits/make_unsigned.h b/libcxx/include/__type_traits/make_unsigned.h index 83ff8b7bb8014..8e11010366343 100644 --- a/libcxx/include/__type_traits/make_unsigned.h +++ b/libcxx/include/__type_traits/make_unsigned.h @@ -73,7 +73,7 @@ using __make_unsigned_t = __copy_cv_t<_Tp, typename __make_unsigned<__remove_cv_ #endif // __has_builtin(__make_unsigned) template -struct make_unsigned { +struct _LIBCPP_NO_SPECIALIZATIONS make_unsigned { using type _LIBCPP_NODEBUG = __make_unsigned_t<_Tp>; }; diff --git a/libcxx/include/__type_traits/negation.h b/libcxx/include/__type_traits/negation.h index a72e62d3f96e0..a745a999a8bfb 100644 --- a/libcxx/include/__type_traits/negation.h +++ b/libcxx/include/__type_traits/negation.h @@ -23,9 +23,9 @@ struct _Not : _BoolConstant {}; #if _LIBCPP_STD_VER >= 17 template -struct negation : _Not<_Tp> {}; +struct _LIBCPP_NO_SPECIALIZATIONS negation : _Not<_Tp> {}; template -inline constexpr bool negation_v = !_Tp::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool negation_v = !_Tp::value; #endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/rank.h b/libcxx/include/__type_traits/rank.h index aeeedec40dee5..1745660ce5ef7 100644 --- a/libcxx/include/__type_traits/rank.h +++ b/libcxx/include/__type_traits/rank.h @@ -28,17 +28,23 @@ struct rank : integral_constant {}; #else template -struct _LIBCPP_TEMPLATE_VIS rank : public integral_constant {}; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS rank : public integral_constant {}; + +_LIBCPP_DIAGNOSTIC_PUSH +# if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +# endif template struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> : public integral_constant::value + 1> {}; template struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> : public integral_constant::value + 1> {}; +_LIBCPP_DIAGNOSTIC_POP #endif // __has_builtin(__array_rank) #if _LIBCPP_STD_VER >= 17 template -inline constexpr size_t rank_v = rank<_Tp>::value; +_LIBCPP_NO_SPECIALIZATIONS inline constexpr size_t rank_v = rank<_Tp>::value; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__type_traits/remove_all_extents.h b/libcxx/include/__type_traits/remove_all_extents.h index d46a3228b4ab5..cb40ea4e4e1e0 100644 --- a/libcxx/include/__type_traits/remove_all_extents.h +++ b/libcxx/include/__type_traits/remove_all_extents.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__remove_all_extents) template -struct remove_all_extents { +struct _LIBCPP_NO_SPECIALIZATIONS remove_all_extents { using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp); }; diff --git a/libcxx/include/__type_traits/remove_const.h b/libcxx/include/__type_traits/remove_const.h index 6250d9f531170..37315c5229ee8 100644 --- a/libcxx/include/__type_traits/remove_const.h +++ b/libcxx/include/__type_traits/remove_const.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__remove_const) template -struct remove_const { +struct _LIBCPP_NO_SPECIALIZATIONS remove_const { using type _LIBCPP_NODEBUG = __remove_const(_Tp); }; diff --git a/libcxx/include/__type_traits/remove_cv.h b/libcxx/include/__type_traits/remove_cv.h index 16848e6d71128..0beaf3367ecba 100644 --- a/libcxx/include/__type_traits/remove_cv.h +++ b/libcxx/include/__type_traits/remove_cv.h @@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct remove_cv { +struct _LIBCPP_NO_SPECIALIZATIONS remove_cv { using type _LIBCPP_NODEBUG = __remove_cv(_Tp); }; diff --git a/libcxx/include/__type_traits/remove_cvref.h b/libcxx/include/__type_traits/remove_cvref.h index e3c65944e33c1..39ea0f657769e 100644 --- a/libcxx/include/__type_traits/remove_cvref.h +++ b/libcxx/include/__type_traits/remove_cvref.h @@ -38,7 +38,7 @@ using __is_same_uncvref _LIBCPP_NODEBUG = _IsSame<__remove_cvref_t<_Tp>, __remov #if _LIBCPP_STD_VER >= 20 template -struct remove_cvref { +struct _LIBCPP_NO_SPECIALIZATIONS remove_cvref { using type _LIBCPP_NODEBUG = __remove_cvref(_Tp); }; diff --git a/libcxx/include/__type_traits/remove_extent.h b/libcxx/include/__type_traits/remove_extent.h index 95a7971d7a9c2..636e392c9b107 100644 --- a/libcxx/include/__type_traits/remove_extent.h +++ b/libcxx/include/__type_traits/remove_extent.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__remove_extent) template -struct remove_extent { +struct _LIBCPP_NO_SPECIALIZATIONS remove_extent { using type _LIBCPP_NODEBUG = __remove_extent(_Tp); }; diff --git a/libcxx/include/__type_traits/remove_pointer.h b/libcxx/include/__type_traits/remove_pointer.h index 47cd1cd1d80fa..2f7ac151e9376 100644 --- a/libcxx/include/__type_traits/remove_pointer.h +++ b/libcxx/include/__type_traits/remove_pointer.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) template -struct remove_pointer { +struct _LIBCPP_NO_SPECIALIZATIONS remove_pointer { using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); }; diff --git a/libcxx/include/__type_traits/remove_reference.h b/libcxx/include/__type_traits/remove_reference.h index f68815691ac0f..7cc3ca1705de2 100644 --- a/libcxx/include/__type_traits/remove_reference.h +++ b/libcxx/include/__type_traits/remove_reference.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__remove_reference_t) template -struct remove_reference { +struct _LIBCPP_NO_SPECIALIZATIONS remove_reference { using type _LIBCPP_NODEBUG = __remove_reference_t(_Tp); }; diff --git a/libcxx/include/__type_traits/remove_volatile.h b/libcxx/include/__type_traits/remove_volatile.h index 099945df01241..5d73f7e5d241c 100644 --- a/libcxx/include/__type_traits/remove_volatile.h +++ b/libcxx/include/__type_traits/remove_volatile.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__remove_volatile) template -struct remove_volatile { +struct _LIBCPP_NO_SPECIALIZATIONS remove_volatile { using type _LIBCPP_NODEBUG = __remove_volatile(_Tp); }; diff --git a/libcxx/include/__type_traits/type_identity.h b/libcxx/include/__type_traits/type_identity.h index b0b5a1277d596..f526aef4d5b2f 100644 --- a/libcxx/include/__type_traits/type_identity.h +++ b/libcxx/include/__type_traits/type_identity.h @@ -27,7 +27,7 @@ using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type; #if _LIBCPP_STD_VER >= 20 template -struct type_identity { +struct _LIBCPP_NO_SPECIALIZATIONS type_identity { typedef _Tp type; }; template diff --git a/libcxx/include/__type_traits/underlying_type.h b/libcxx/include/__type_traits/underlying_type.h index 16e7501dee17d..45a9b40e3e4c9 100644 --- a/libcxx/include/__type_traits/underlying_type.h +++ b/libcxx/include/__type_traits/underlying_type.h @@ -30,7 +30,7 @@ struct __underlying_type_impl<_Tp, true> { }; template -struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; +struct _LIBCPP_NO_SPECIALIZATIONS underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; #if _LIBCPP_STD_VER >= 14 template diff --git a/libcxx/include/__type_traits/unwrap_ref.h b/libcxx/include/__type_traits/unwrap_ref.h index 11a069d663023..e8ca2b5028f6c 100644 --- a/libcxx/include/__type_traits/unwrap_ref.h +++ b/libcxx/include/__type_traits/unwrap_ref.h @@ -34,13 +34,13 @@ using __unwrap_ref_decay_t _LIBCPP_NODEBUG = typename __unwrap_reference<__decay #if _LIBCPP_STD_VER >= 20 template -struct unwrap_reference : __unwrap_reference<_Tp> {}; +struct _LIBCPP_NO_SPECIALIZATIONS unwrap_reference : __unwrap_reference<_Tp> {}; template using unwrap_reference_t = typename unwrap_reference<_Tp>::type; template -struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {}; +struct _LIBCPP_NO_SPECIALIZATIONS unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {}; template using unwrap_ref_decay_t = __unwrap_ref_decay_t<_Tp>; diff --git a/libcxx/include/execution b/libcxx/include/execution index 7c695997cd047..5b1915a998732 100644 --- a/libcxx/include/execution +++ b/libcxx/include/execution @@ -96,6 +96,10 @@ inline constexpr unsequenced_policy unseq{__disable_user_instantiations_tag{}}; } // namespace execution +_LIBCPP_DIAGNOSTIC_PUSH +# if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +# endif template <> inline constexpr bool is_execution_policy_v = true; @@ -107,6 +111,7 @@ inline constexpr bool is_execution_policy_v inline constexpr bool is_execution_policy_v = true; +_LIBCPP_DIAGNOSTIC_POP template <> inline constexpr bool __is_parallel_execution_policy_impl = true; @@ -121,8 +126,13 @@ template <> inline constexpr bool __is_unsequenced_execution_policy_impl = true; # if _LIBCPP_STD_VER >= 20 +_LIBCPP_DIAGNOSTIC_PUSH +# if __has_warning("-Winvalid-specialization") +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization") +# endif template <> inline constexpr bool is_execution_policy_v = true; +_LIBCPP_DIAGNOSTIC_POP template <> inline constexpr bool __is_unsequenced_execution_policy_impl = true; @@ -130,7 +140,7 @@ inline constexpr bool __is_unsequenced_execution_policy_impl -struct is_execution_policy : bool_constant> {}; +struct _LIBCPP_NO_SPECIALIZATIONS is_execution_policy : bool_constant> {}; template _LIBCPP_HIDE_FROM_ABI auto __remove_parallel_policy(const _ExecutionPolicy&) { diff --git a/libcxx/include/variant b/libcxx/include/variant index 6c7be7f8f1eb5..3786d9524020b 100644 --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -1156,7 +1156,7 @@ visit(_Visitor&& __visitor, _Vs&&... __vs); # endif template -class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES variant +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DECLSPEC_EMPTY_BASES _LIBCPP_NO_SPECIALIZATIONS variant : private __sfinae_ctor_base< __all...>::value, __all...>::value>, private __sfinae_assign_base< diff --git a/libcxx/test/libcxx/algorithms/no_specializations.verify.cpp b/libcxx/test/libcxx/algorithms/no_specializations.verify.cpp new file mode 100644 index 0000000000000..5b2475252b602 --- /dev/null +++ b/libcxx/test/libcxx/algorithms/no_specializations.verify.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14 + +// UNSUPPORTED: libcpp-has-no-incomplete-pstl + +// Check that user-specializations are diagnosed +// See [execpol.type]/3 + +#include + +#if !__has_warning("-Winvalid-specializations") +// expected-no-diagnostics +#else +struct S {}; + +template <> +struct std::is_execution_policy; // expected-error {{cannot be specialized}} + +template <> +constexpr bool std::is_execution_policy_v = false; // expected-error {{cannot be specialized}} +#endif diff --git a/libcxx/test/libcxx/language.support/no_specializations.verify.cpp b/libcxx/test/libcxx/language.support/no_specializations.verify.cpp new file mode 100644 index 0000000000000..b7b75b7e9a00d --- /dev/null +++ b/libcxx/test/libcxx/language.support/no_specializations.verify.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// Check that user-specializations are diagnosed +// See [cmp.result]/1 + +#include + +#if !__has_warning("-Winvalid-specialization") +// expected-no-diagnostics +#else +struct S {}; + +template <> +struct std::compare_three_way_result; // expected-error {{cannot be specialized}} +#endif diff --git a/libcxx/test/libcxx/ranges/no_specializations.verify.cpp b/libcxx/test/libcxx/ranges/no_specializations.verify.cpp new file mode 100644 index 0000000000000..69d458a920558 --- /dev/null +++ b/libcxx/test/libcxx/ranges/no_specializations.verify.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// Check that user-specializations are diagnosed +// See [range.adaptor.object]/5 + +#include + +#if !__has_warning("-Winvalid-specialization") +// expected-no-diagnostics +#else +struct S {}; + +template <> +class std::ranges::range_adaptor_closure; // expected-error {{cannot be specialized}} +#endif diff --git a/libcxx/test/libcxx/type_traits/no_specializations.verify.cpp b/libcxx/test/libcxx/type_traits/no_specializations.verify.cpp new file mode 100644 index 0000000000000..e6d960667e8c0 --- /dev/null +++ b/libcxx/test/libcxx/type_traits/no_specializations.verify.cpp @@ -0,0 +1,176 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14 + +// Check that user-specializations are diagnosed +// See [meta.rqmts]/4, [meta.trans.other]/5, [meta.trans.other]/7 + +#include + +#include "test_macros.h" + +#if !__has_warning("-Winvalid-specialization") +// expected-no-diagnostics +#else +struct S {}; + +# define SPECIALIZE_TRAIT(Trait) \ + template <> \ + struct std::Trait + +SPECIALIZE_TRAIT(add_const); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(add_cv); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(add_volatile); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(add_lvalue_reference); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(add_rvalue_reference); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(add_pointer); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(decay); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(invoke_result); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(make_unsigned); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_all_extents); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_const); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_cv); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_cvref); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_extent); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_pointer); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_reference); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(remove_volatile); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(type_identity); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(underlying_type); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(unwrap_reference); // expected-error {{cannot be specialized}} +SPECIALIZE_TRAIT(unwrap_ref_decay); // expected-error {{cannot be specialized}} + +# undef SPECIALIZE_TRAIT +# define SPECIALIZE_UTT(Trait) \ + template <> \ + struct std::Trait; \ + template <> \ + inline constexpr bool std::Trait##_v = false + +# define SPECIALIZE_BTT(Trait) \ + template <> \ + struct std::Trait; \ + template <> \ + inline constexpr bool std::Trait##_v = false + +SPECIALIZE_UTT(alignment_of); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(conjunction); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(disjunction); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(extent); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(has_unique_object_representations); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_abstract); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_aggregate); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_arithmetic); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_array); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_base_of); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_class); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_compound); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_const); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_convertible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_copy_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_copy_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_default_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_destructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_empty); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_enum); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_final); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_floating_point); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_function); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_fundamental); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_integral); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_invocable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_invocable_r); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_lvalue_reference); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_member_pointer); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_member_object_pointer); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_member_function_pointer); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_move_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_move_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_nothrow_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_nothrow_convertible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_copy_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_copy_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_default_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_destructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_move_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_move_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_invocable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_nothrow_invocable_r); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_nothrow_swappable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_nothrow_swappable_with); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_null_pointer); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_object); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_pod); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_pointer); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_polymorphic); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_reference); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_rvalue_reference); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_same); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_scalar); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_signed); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_standard_layout); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_swappable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_swappable_with); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivial); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_BTT(is_trivially_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_copy_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_copy_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_copyable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_default_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_destructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_move_assignable); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_trivially_move_constructible); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_unbounded_array); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_union); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_unsigned); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_void); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_volatile); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(negation); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(rank); // expected-error 2 {{cannot be specialized}} + +# if TEST_STD_VER <= 17 +SPECIALIZE_UTT(is_literal_type); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(result_of); // expected-error 2 {{cannot be specialized}} +# endif + +# if TEST_STD_VER >= 20 +SPECIALIZE_UTT(is_bounded_array); // expected-error 2 {{cannot be specialized}} +# endif + +# if TEST_STD_VER >= 23 +SPECIALIZE_UTT(is_implicit_lifetime); // expected-error 2 {{cannot be specialized}} +SPECIALIZE_UTT(is_scoped_enum); // expected-error 2 {{cannot be specialized}} +# endif + +# if TEST_STD_VER >= 26 +SPECIALIZE_BTT(is_virtual_base_of); // expected-error 2 {{cannot be specialized}} +# endif + +# undef SPECIALIZE_UTT +# undef SPECIALIZE_BTT + +template <> +struct std::aligned_storage<1, 3>; // expected-error {{cannot be specialized}} + +template <> +struct std::aligned_union<1, S>; // expected-error {{cannot be specialized}} + +template <> +struct std::conditional; // expected-error {{cannot be specialized}} + +template <> +struct std::enable_if; // expected-error {{cannot be specialized}} + +template <> +struct std::integral_constant; // expected-error {{cannot be specialized}} +#endif diff --git a/libcxx/test/libcxx/utilities/format/no_specializations.verify.cpp b/libcxx/test/libcxx/utilities/format/no_specializations.verify.cpp new file mode 100644 index 0000000000000..e1acbaf16f5b4 --- /dev/null +++ b/libcxx/test/libcxx/utilities/format/no_specializations.verify.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// Check that user-specializations are diagnosed +// See [format.arg]/2 + +#include + +#if !__has_warning("-Winvalid-specialization") +// expected-no-diagnostics +#else +struct S {}; + +template <> +class std::basic_format_arg; // expected-error {{cannot be specialized}} +#endif diff --git a/libcxx/test/libcxx/utilities/no_specializations.verify.cpp b/libcxx/test/libcxx/utilities/no_specializations.verify.cpp new file mode 100644 index 0000000000000..d4743f4fd3f90 --- /dev/null +++ b/libcxx/test/libcxx/utilities/no_specializations.verify.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14 + +// Check that user-specializations are diagnosed +// See [variant.variant.general]/4 + +#include + +#if !__has_warning("-Winvalid-specialization") +// expected-no-diagnostics +#else +struct S {}; + +template <> +class std::variant; // expected-error {{cannot be specialized}} +#endif