[libc++] Use [[clang::no_specializations]] to diagnose invalid user specializations (#118167)

Some templates in the standard library are illegal to specialize for users
(even if the specialization contains user-defined types). The [[clang::no_specializations]]
attribute allows marking such base templates so that the compiler will
diagnose if users try adding a specialization.
This commit is contained in:
Nikolas Klauser
2025-01-23 13:18:54 +01:00
committed by GitHub
parent 0236cb6895
commit 6f684816e2
93 changed files with 591 additions and 204 deletions

View File

@@ -33,7 +33,8 @@ struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<
};
template <class _Tp, class _Up = _Tp>
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 <class _Tp, class _Up = _Tp>
using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type;

View File

@@ -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

View File

@@ -277,7 +277,7 @@ public:
};
template <class _Context>
class _LIBCPP_TEMPLATE_VIS basic_format_arg {
class _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
public:
class _LIBCPP_TEMPLATE_VIS handle;

View File

@@ -85,7 +85,7 @@ template <_RangeAdaptorClosure _Closure, _RangeAdaptorClosure _OtherClosure>
# if _LIBCPP_STD_VER >= 23
template <class _Tp>
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

View File

@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
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 <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS add_volatile {
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS add_volatile {
using type _LIBCPP_NODEBUG = volatile _Tp;
};

View File

@@ -40,7 +40,7 @@ using __add_lvalue_reference_t = typename __add_lvalue_reference_impl<_Tp>::type
#endif // __has_builtin(__add_lvalue_reference)
template <class _Tp>
struct add_lvalue_reference {
struct _LIBCPP_NO_SPECIALIZATIONS add_lvalue_reference {
using type _LIBCPP_NODEBUG = __add_lvalue_reference_t<_Tp>;
};

View File

@@ -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 <class _Tp>
struct add_pointer {
struct _LIBCPP_NO_SPECIALIZATIONS add_pointer {
using type _LIBCPP_NODEBUG = __add_pointer_t<_Tp>;
};

View File

@@ -40,7 +40,7 @@ using __add_rvalue_reference_t = typename __add_rvalue_reference_impl<_Tp>::type
#endif // __has_builtin(__add_rvalue_reference)
template <class _Tp>
struct add_rvalue_reference {
struct _LIBCPP_NO_SPECIALIZATIONS add_rvalue_reference {
using type = __add_rvalue_reference_t<_Tp>;
};

View File

@@ -68,7 +68,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 <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::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];
};

View File

@@ -33,7 +33,7 @@ struct __static_max<_I0, _I1, _In...> {
};
template <size_t _Len, class _Type0, class... _Types>
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;

View File

@@ -20,11 +20,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS alignment_of : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS alignment_of
: public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -36,13 +36,19 @@ template <bool _Cond, class _IfRes, class _ElseRes>
using _If _LIBCPP_NODEBUG = typename _IfImpl<_Cond>::template _Select<_IfRes, _ElseRes>;
template <bool _Bp, class _If, class _Then>
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 <class _If, class _Then>
struct _LIBCPP_TEMPLATE_VIS conditional<false, _If, _Then> {
using type _LIBCPP_NODEBUG = _Then;
};
_LIBCPP_DIAGNOSTIC_POP
#if _LIBCPP_STD_VER >= 14
template <bool _Bp, class _IfRes, class _ElseRes>

View File

@@ -47,16 +47,21 @@ struct __all : _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...
#if _LIBCPP_STD_VER >= 17
template <class...>
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 <class _Arg>
struct conjunction<_Arg> : _Arg {};
template <class _Arg, class... _Args>
struct conjunction<_Arg, _Args...> : conditional_t<!bool(_Arg::value), _Arg, conjunction<_Args...>> {};
_LIBCPP_DIAGNOSTIC_POP
template <class... _Args>
inline constexpr bool conjunction_v = conjunction<_Args...>::value;
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool conjunction_v = conjunction<_Args...>::value;
#endif // _LIBCPP_STD_VER >= 17

View File

@@ -30,7 +30,7 @@ template <class _Tp>
using __decay_t _LIBCPP_NODEBUG = __decay(_Tp);
template <class _Tp>
struct decay {
struct _LIBCPP_NO_SPECIALIZATIONS decay {
using type _LIBCPP_NODEBUG = __decay_t<_Tp>;
};

View File

@@ -46,10 +46,10 @@ using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _R
#if _LIBCPP_STD_VER >= 17
template <class... _Args>
struct disjunction : _Or<_Args...> {};
struct _LIBCPP_NO_SPECIALIZATIONS disjunction : _Or<_Args...> {};
template <class... _Args>
inline constexpr bool disjunction_v = _Or<_Args...>::value;
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool disjunction_v = _Or<_Args...>::value;
#endif // _LIBCPP_STD_VER >= 17

View File

@@ -18,11 +18,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <bool, class _Tp = void>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {
typedef _Tp type;
};
_LIBCPP_DIAGNOSTIC_POP
template <bool _Bp, class _Tp = void>
using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type;

View File

@@ -22,11 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__array_extent)
template <class _Tp, size_t _Dim = 0>
struct _LIBCPP_TEMPLATE_VIS extent : integral_constant<size_t, __array_extent(_Tp, _Dim)> {};
struct _LIBCPP_NO_SPECIALIZATIONS _LIBCPP_TEMPLATE_VIS extent : integral_constant<size_t, __array_extent(_Tp, _Dim)> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp, unsigned _Ip = 0>
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)

View File

@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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<bool, __has_unique_object_representations(remove_all_extents_t<_Tp>)> {};
template <class _Tp>
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

View File

@@ -19,11 +19,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS has_virtual_destructor
: public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, _Tp __v>
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;

View File

@@ -278,34 +278,37 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Ret __invoke_r(_Args&&... _
// is_invocable
template <class _Fn, class... _Args>
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 <class _Ret, class _Fn, class... _Args>
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 <class _Fn, class... _Args>
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 <class _Ret, class _Fn, class... _Args>
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 <class _Fn, class... _Args>
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 <class _Ret, class _Fn, class... _Args>
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 <class _Fn, class... _Args>
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 <class _Ret, class _Fn, class... _Args>
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 <class _Fn, class... _Args>
struct _LIBCPP_TEMPLATE_VIS invoke_result : __invoke_result<_Fn, _Args...> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS invoke_result : __invoke_result<_Fn, _Args...> {};
template <class _Fn, class... _Args>
using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;

View File

@@ -19,11 +19,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_abstract : public integral_constant<bool, __is_abstract(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_abstract
: public integral_constant<bool, __is_abstract(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -21,10 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_aggregate
: public integral_constant<bool, __is_aggregate(_Tp)> {};
template <class _Tp>
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

View File

@@ -21,12 +21,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_arithmetic
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_arithmetic
: public integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
(!defined(_LIBCPP_COMPILER_CLANG_BASED) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1900))
template <class _Tp>
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 <class _Tp>
inline constexpr bool is_array_v = __is_array(_Tp);
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_array_v = __is_array(_Tp);
# endif
#else

View File

@@ -21,30 +21,30 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Up>
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 <class _Tp, class _Arg>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_copy_assignable
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_copy_assignable
: public integral_constant<bool,
__is_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<const _Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_move_assignable
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_move_assignable
: public integral_constant<bool, __is_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -19,21 +19,23 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Bp, class _Dp>
struct _LIBCPP_TEMPLATE_VIS is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_base_of
: public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Bp, class _Dp>
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 <class _Base, class _Derived>
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 <class _Base, class _Derived>
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

View File

@@ -27,12 +27,18 @@ inline const bool __is_bounded_array_v<_Tp[_Np]> = true;
#if _LIBCPP_STD_VER >= 20
template <class>
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 <class _Tp, size_t _Np>
struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {};
_LIBCPP_DIAGNOSTIC_POP
template <class _Tp>
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

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_class : public integral_constant<bool, __is_class(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_class : public integral_constant<bool, __is_class(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -22,11 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_compound)
template <class _Tp>
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 <class _Tp>
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)

View File

@@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_const)
template <class _Tp>
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 <class _Tp>
inline constexpr bool is_const_v = __is_const(_Tp);
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_const_v = __is_const(_Tp);
# endif
#else

View File

@@ -21,37 +21,39 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_constructible : public integral_constant<bool, __is_constructible(_Tp, _Args...)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_constructible
: public integral_constant<bool, __is_constructible(_Tp, _Args...)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class... _Args>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_copy_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_copy_constructible
: public integral_constant<bool, __is_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_move_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_move_constructible
: public integral_constant<bool, __is_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_default_constructible : public integral_constant<bool, __is_constructible(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_default_constructible
: public integral_constant<bool, __is_constructible(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -19,11 +19,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _T1, class _T2>
struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_convertible
: public integral_constant<bool, __is_convertible(_T1, _T2)> {};
#if _LIBCPP_STD_VER >= 17
template <class _From, class _To>
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

View File

@@ -25,11 +25,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_destructible)
template <class _Tp>
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 <class _Tp>
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)

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_empty : public integral_constant<bool, __is_empty(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_empty : public integral_constant<bool, __is_empty(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -19,20 +19,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant<bool, __is_enum(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_enum : public integral_constant<bool, __is_enum(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
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 <class _Tp>
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

View File

@@ -21,7 +21,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class>
inline constexpr bool is_execution_policy_v = false;
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_execution_policy_v = false;
template <class>
inline constexpr bool __is_unsequenced_execution_policy_impl = false;

View File

@@ -23,12 +23,12 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_is_final : public integral_constant<bool, _
#if _LIBCPP_STD_VER >= 14
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_final : public integral_constant<bool, __is_final(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_final : public integral_constant<bool, __is_final(_Tp)> {};
#endif
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -27,11 +27,12 @@ template <> struct __libcpp_is_floating_point<long double> : public tru
// clang-format on
template <class _Tp>
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 <class _Tp>
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

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_function : integral_constant<bool, __is_function(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_function : integral_constant<bool, __is_function(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_fundamental)
template <class _Tp>
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 <class _Tp>
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)

View File

@@ -22,10 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
# if __has_builtin(__builtin_is_implicit_lifetime)
template <class _Tp>
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 <class _Tp>
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

View File

@@ -50,11 +50,11 @@ template <> struct __libcpp_is_integral<__uint128_t> { enum { va
#if __has_builtin(__is_integral)
template <class _Tp>
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 <class _Tp>
inline constexpr bool is_integral_v = __is_integral(_Tp);
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_integral_v = __is_integral(_Tp);
# endif
#else

View File

@@ -20,12 +20,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS
_LIBCPP_DEPRECATED_IN_CXX17 is_literal_type : public integral_constant<bool, __is_literal_type(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_NO_SPECIALIZATIONS is_literal_type
: public integral_constant<bool, __is_literal_type(_Tp)> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
_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)

View File

@@ -19,23 +19,25 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
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 <class _Tp>
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 <class _Tp>
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 <class _Tp>
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 <class _Tp>
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 <class _Tp>
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

View File

@@ -21,34 +21,34 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Arg>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {
};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_assignable
: public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Arg>
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 <class _Tp>
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<const _Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_move_assignable
: public integral_constant<bool,
__is_nothrow_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {
};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -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<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class... _Args>
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 <class _Tp>
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<const _Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_move_constructible
: public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_default_constructible
: public integral_constant<bool, __is_nothrow_constructible(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -29,10 +29,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
# if __has_builtin(__is_nothrow_convertible)
template <class _Tp, class _Up>
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 <class _Tp, class _Up>
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)

View File

@@ -24,7 +24,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_nothrow_destructible)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible : integral_constant<bool, __is_nothrow_destructible(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_destructible
: integral_constant<bool, __is_nothrow_destructible(_Tp)> {};
#else
@@ -55,7 +56,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&> : public true_type {}
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -24,11 +24,12 @@ inline const bool __is_null_pointer_v = __is_same(__remove_cv(_Tp), nullptr_t);
#if _LIBCPP_STD_VER >= 14
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_null_pointer : integral_constant<bool, __is_null_pointer_v<_Tp>> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_null_pointer
: integral_constant<bool, __is_null_pointer_v<_Tp>> {};
# if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
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 <class _Tp>
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

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_pod : public integral_constant<bool, __is_pod(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_pod : public integral_constant<bool, __is_pod(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -22,11 +22,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_pointer)
template <class _Tp>
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 <class _Tp>
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)

View File

@@ -19,11 +19,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_polymorphic
: public integral_constant<bool, __is_polymorphic(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -19,26 +19,28 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
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 <class _Tp>
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 <class _Tp>
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 <class _Tp>
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 <class _Tp>
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 <class _Tp>
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)

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Up>
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 <class _Tp, class _Up>
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<T,U> has the same effect as is_same<T,U> but instantiates fewer types:

View File

@@ -26,11 +26,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_scalar)
template <class _Tp>
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 <class _Tp>
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)

View File

@@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_signed)
template <class _Tp>
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 <class _Tp>
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)

View File

@@ -19,11 +19,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_standard_layout : public integral_constant<bool, __is_standard_layout(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_standard_layout
: public integral_constant<bool, __is_standard_layout(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -74,30 +74,33 @@ inline const bool __is_nothrow_swappable_with_v<_Tp, _Up, true> =
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Up>
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 <class _Tp, class _Up>
struct _LIBCPP_TEMPLATE_VIS is_swappable_with : bool_constant<is_swappable_with_v<_Tp, _Up>> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_swappable_with
: bool_constant<is_swappable_with_v<_Tp, _Up>> {};
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_swappable : bool_constant<is_swappable_v<_Tp>> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_swappable : bool_constant<is_swappable_v<_Tp>> {};
template <class _Tp, class _Up>
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 <class _Tp, class _Up>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with : bool_constant<is_nothrow_swappable_with_v<_Tp, _Up>> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_swappable_with
: bool_constant<is_nothrow_swappable_with_v<_Tp, _Up>> {};
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable : bool_constant<is_nothrow_swappable_v<_Tp>> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_swappable
: bool_constant<is_nothrow_swappable_v<_Tp>> {};
#endif // _LIBCPP_STD_VER >= 17

View File

@@ -19,11 +19,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_trivial : public integral_constant<bool, __is_trivial(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivial : public integral_constant<bool, __is_trivial(_Tp)> {
};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -21,33 +21,36 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Arg>
struct is_trivially_assignable : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> {};
struct _LIBCPP_NO_SPECIALIZATIONS is_trivially_assignable
: integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Arg>
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 <class _Tp>
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<const _Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
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 <class _Tp>
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

View File

@@ -21,39 +21,43 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_constructible
: integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class... _Args>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_copy_constructible
: public integral_constant<bool, __is_trivially_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_move_constructible
: public integral_constant<bool, __is_trivially_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_default_constructible
: public integral_constant<bool, __is_trivially_constructible(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -20,11 +20,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable : public integral_constant<bool, __is_trivially_copyable(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_copyable
: public integral_constant<bool, __is_trivially_copyable(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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 <class _Tp>

View File

@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_trivially_destructible)
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_trivially_destructible
: public integral_constant<bool, __is_trivially_destructible(_Tp)> {};
#elif __has_builtin(__has_trivial_destructor)
@@ -39,7 +39,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -26,12 +26,18 @@ inline const bool __is_unbounded_array_v<_Tp[]> = true;
#if _LIBCPP_STD_VER >= 20
template <class>
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 <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {};
_LIBCPP_DIAGNOSTIC_POP
template <class _Tp>
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

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_union : public integral_constant<bool, __is_union(_Tp)> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_union : public integral_constant<bool, __is_union(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -23,11 +23,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_unsigned)
template <class _Tp>
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 <class _Tp>
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)

View File

@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
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 <class _Tp>
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

View File

@@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_volatile)
template <class _Tp>
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 <class _Tp>
inline constexpr bool is_volatile_v = __is_volatile(_Tp);
_LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_volatile_v = __is_volatile(_Tp);
# endif
#else

View File

@@ -70,7 +70,7 @@ using __make_signed_t = __copy_cv_t<_Tp, typename __make_signed<__remove_cv_t<_T
#endif // __has_builtin(__make_signed)
template <class _Tp>
struct make_signed {
struct _LIBCPP_NO_SPECIALIZATIONS make_signed {
using type _LIBCPP_NODEBUG = __make_signed_t<_Tp>;
};

View File

@@ -72,7 +72,7 @@ using __make_unsigned_t = __copy_cv_t<_Tp, typename __make_unsigned<__remove_cv_
#endif // __has_builtin(__make_unsigned)
template <class _Tp>
struct make_unsigned {
struct _LIBCPP_NO_SPECIALIZATIONS make_unsigned {
using type _LIBCPP_NODEBUG = __make_unsigned_t<_Tp>;
};

View File

@@ -23,9 +23,9 @@ struct _Not : _BoolConstant<!_Pred::value> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
struct negation : _Not<_Tp> {};
struct _LIBCPP_NO_SPECIALIZATIONS negation : _Not<_Tp> {};
template <class _Tp>
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

View File

@@ -28,17 +28,23 @@ struct rank : integral_constant<size_t, __array_rank(_Tp)> {};
#else
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS rank : public integral_constant<size_t, 0> {};
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS rank : public integral_constant<size_t, 0> {};
_LIBCPP_DIAGNOSTIC_PUSH
# if __has_warning("-Winvalid-specialization")
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Winvalid-specialization")
# endif
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> : public integral_constant<size_t, rank<_Tp>::value + 1> {};
template <class _Tp, size_t _Np>
struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> : public integral_constant<size_t, rank<_Tp>::value + 1> {};
_LIBCPP_DIAGNOSTIC_POP
#endif // __has_builtin(__array_rank)
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
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

View File

@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__remove_all_extents)
template <class _Tp>
struct remove_all_extents {
struct _LIBCPP_NO_SPECIALIZATIONS remove_all_extents {
using type _LIBCPP_NODEBUG = __remove_all_extents(_Tp);
};

View File

@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__remove_const)
template <class _Tp>
struct remove_const {
struct _LIBCPP_NO_SPECIALIZATIONS remove_const {
using type _LIBCPP_NODEBUG = __remove_const(_Tp);
};

View File

@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct remove_cv {
struct _LIBCPP_NO_SPECIALIZATIONS remove_cv {
using type _LIBCPP_NODEBUG = __remove_cv(_Tp);
};

View File

@@ -36,7 +36,7 @@ using __is_same_uncvref _LIBCPP_NODEBUG = _IsSame<__remove_cvref_t<_Tp>, __remov
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct remove_cvref {
struct _LIBCPP_NO_SPECIALIZATIONS remove_cvref {
using type _LIBCPP_NODEBUG = __remove_cvref(_Tp);
};

View File

@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__remove_extent)
template <class _Tp>
struct remove_extent {
struct _LIBCPP_NO_SPECIALIZATIONS remove_extent {
using type _LIBCPP_NODEBUG = __remove_extent(_Tp);
};

View File

@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer)
template <class _Tp>
struct remove_pointer {
struct _LIBCPP_NO_SPECIALIZATIONS remove_pointer {
using type _LIBCPP_NODEBUG = __remove_pointer(_Tp);
};

View File

@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__remove_reference_t)
template <class _Tp>
struct remove_reference {
struct _LIBCPP_NO_SPECIALIZATIONS remove_reference {
using type _LIBCPP_NODEBUG = __remove_reference_t(_Tp);
};

View File

@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__remove_volatile)
template <class _Tp>
struct remove_volatile {
struct _LIBCPP_NO_SPECIALIZATIONS remove_volatile {
using type _LIBCPP_NODEBUG = __remove_volatile(_Tp);
};

View File

@@ -27,7 +27,7 @@ using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type;
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct type_identity {
struct _LIBCPP_NO_SPECIALIZATIONS type_identity {
typedef _Tp type;
};
template <class _Tp>

View File

@@ -30,7 +30,7 @@ struct __underlying_type_impl<_Tp, true> {
};
template <class _Tp>
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 <class _Tp>

View File

@@ -34,13 +34,13 @@ using __unwrap_ref_decay_t _LIBCPP_NODEBUG = typename __unwrap_reference<__decay
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct unwrap_reference : __unwrap_reference<_Tp> {};
struct _LIBCPP_NO_SPECIALIZATIONS unwrap_reference : __unwrap_reference<_Tp> {};
template <class _Tp>
using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
template <class _Tp>
struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {};
struct _LIBCPP_NO_SPECIALIZATIONS unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {};
template <class _Tp>
using unwrap_ref_decay_t = __unwrap_ref_decay_t<_Tp>;

View File

@@ -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<execution::sequenced_policy> = true;
@@ -107,6 +111,7 @@ inline constexpr bool is_execution_policy_v<execution::parallel_unsequenced_poli
template <>
inline constexpr bool is_execution_policy_v<execution::__unsequenced_policy> = true;
_LIBCPP_DIAGNOSTIC_POP
template <>
inline constexpr bool __is_parallel_execution_policy_impl<execution::parallel_policy> = true;
@@ -121,8 +126,13 @@ template <>
inline constexpr bool __is_unsequenced_execution_policy_impl<execution::parallel_unsequenced_policy> = 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<execution::unsequenced_policy> = true;
_LIBCPP_DIAGNOSTIC_POP
template <>
inline constexpr bool __is_unsequenced_execution_policy_impl<execution::unsequenced_policy> = true;
@@ -130,7 +140,7 @@ inline constexpr bool __is_unsequenced_execution_policy_impl<execution::unsequen
# endif
template <class _Tp>
struct is_execution_policy : bool_constant<is_execution_policy_v<_Tp>> {};
struct _LIBCPP_NO_SPECIALIZATIONS is_execution_policy : bool_constant<is_execution_policy_v<_Tp>> {};
template <class _ExecutionPolicy>
_LIBCPP_HIDE_FROM_ABI auto __remove_parallel_policy(const _ExecutionPolicy&) {

View File

@@ -1156,7 +1156,7 @@ visit(_Visitor&& __visitor, _Vs&&... __vs);
# endif
template <class... _Types>
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<is_copy_constructible_v<_Types>...>::value,
__all<is_move_constructible_v<_Types>...>::value>,
private __sfinae_assign_base<

View File

@@ -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 <execution>
#if !__has_warning("-Winvalid-specializations")
// expected-no-diagnostics
#else
struct S {};
template <>
struct std::is_execution_policy<S>; // expected-error {{cannot be specialized}}
template <>
constexpr bool std::is_execution_policy_v<S> = false; // expected-error {{cannot be specialized}}
#endif

View File

@@ -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 <compare>
#if !__has_warning("-Winvalid-specialization")
// expected-no-diagnostics
#else
struct S {};
template <>
struct std::compare_three_way_result<S>; // expected-error {{cannot be specialized}}
#endif

View File

@@ -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 <ranges>
#if !__has_warning("-Winvalid-specialization")
// expected-no-diagnostics
#else
struct S {};
template <>
class std::ranges::range_adaptor_closure<S>; // expected-error {{cannot be specialized}}
#endif

View File

@@ -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 <type_traits>
#include "test_macros.h"
#if !__has_warning("-Winvalid-specialization")
// expected-no-diagnostics
#else
struct S {};
# define SPECIALIZE_TRAIT(Trait) \
template <> \
struct std::Trait<S>
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<S>; \
template <> \
inline constexpr bool std::Trait##_v<S> = false
# define SPECIALIZE_BTT(Trait) \
template <> \
struct std::Trait<S, S>; \
template <> \
inline constexpr bool std::Trait##_v<S, S> = 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<true, S, S>; // expected-error {{cannot be specialized}}
template <>
struct std::enable_if<true, S>; // expected-error {{cannot be specialized}}
template <>
struct std::integral_constant<S, {}>; // expected-error {{cannot be specialized}}
#endif

View File

@@ -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 <format>
#if !__has_warning("-Winvalid-specialization")
// expected-no-diagnostics
#else
struct S {};
template <>
class std::basic_format_arg<S>; // expected-error {{cannot be specialized}}
#endif

View File

@@ -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 <variant>
#if !__has_warning("-Winvalid-specialization")
// expected-no-diagnostics
#else
struct S {};
template <>
class std::variant<S>; // expected-error {{cannot be specialized}}
#endif