Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ffc0c28
Mark templates users shouldn't specialize with _NO_SPECIALIZATIONS
localspook May 23, 2025
1d88ac3
Silence Clang's `-Wunknown-warning-option` warning
localspook May 24, 2025
a55da5a
Guard against evil macros
localspook May 24, 2025
3c05e87
Oops; accidentally removed one `_NO_SPECIALIZATIONS`
localspook May 24, 2025
bfbe3e5
Address feedback
localspook May 24, 2025
d0a2752
Disable tests properly
localspook May 25, 2025
2d45979
Also mark `unary_function` and `binary_function`
localspook Jun 5, 2025
6098e49
Move expected test failures into bogus section
localspook Jun 5, 2025
18bdd7b
Mark more templates in `<system_error>`...
localspook Jun 8, 2025
d52d77b
Realign with main
localspook Jun 24, 2025
2f62b17
Merge branch 'main' into gh5536
StephanTLavavej Sep 18, 2025
1b91ca9
Restore .clang-format; this change is no longer needed with Clang 20.
StephanTLavavej Sep 18, 2025
e3cd834
Drop silencing of `-Wunknown-warning-option` as Clang 20 recognizes `…
StephanTLavavej Sep 18, 2025
4455daf
Sort Clang warning suppressions.
StephanTLavavej Sep 18, 2025
7e6ddcc
Restore libcxx/expected_results.txt; the bogus test was fixed upstream.
StephanTLavavej Sep 18, 2025
a94d706
Add citations, part 1: Define the macros.
StephanTLavavej Sep 18, 2025
f039e81
Add citations, part 2: Update attributes.
StephanTLavavej Sep 18, 2025
6ddd383
Add citations, part 3: Update attribute for initializer_list and make…
StephanTLavavej Sep 18, 2025
8cd9ea8
Add citations, part 4: Mark declarations and definitions consistently.
StephanTLavavej Sep 18, 2025
8f6cf3c
Add citations, part 5: Mark basic_format_parse_context and basic_form…
StephanTLavavej Sep 18, 2025
69c2fd2
Add citations, part 6: Mark variable templates outside of `<type_trai…
StephanTLavavej Sep 18, 2025
3dfe3bf
Add citations, part 7: Mark `<type_traits>` (and `<xtr1common>`) as t…
StephanTLavavej Sep 18, 2025
568f620
Add defenses to __msvc_formatter.hpp.
StephanTLavavej Sep 18, 2025
969e218
Improve comment clarity.
StephanTLavavej Sep 18, 2025
25bd4e0
Update common_reference with dual citations.
StephanTLavavej Sep 18, 2025
a74775a
Comment when specializations are allowed for variable templates and t…
StephanTLavavej Sep 18, 2025
7ded1eb
Mark member class templates `mapping` and `rebind`.
StephanTLavavej Sep 19, 2025
1aa3323
Oops, guard `<mdspan>` and `<scoped_allocator>`.
StephanTLavavej Sep 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions stl/inc/__msvc_chrono.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,20 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN
namespace chrono {
_EXPORT_STD template <class _Rep>
struct treat_as_floating_point : is_floating_point<_Rep> {}; // tests for floating-point type

_EXPORT_STD template <class _Rep>
constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>::value;
_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool treat_as_floating_point_v =
treat_as_floating_point<_Rep>::value;

_EXPORT_STD template <class _Rep>
struct duration_values { // gets arithmetic properties of a type
Expand All @@ -53,7 +60,7 @@ namespace chrono {

#if _HAS_CXX20
_EXPORT_STD template <class _Clock>
constexpr bool is_clock_v = requires {
_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool is_clock_v = requires {
typename _Clock::rep;
typename _Clock::period;
typename _Clock::duration;
Expand All @@ -62,7 +69,7 @@ namespace chrono {
_Clock::now();
};
_EXPORT_STD template <class _Clock>
struct is_clock : bool_constant<is_clock_v<_Clock>> {};
struct _NO_SPECIALIZATIONS_CITING("N5014 [time.traits.is.clock]/2") is_clock : bool_constant<is_clock_v<_Clock>> {};

template <class _Clock>
constexpr bool _Is_clock_v = is_clock_v<_Clock>;
Expand Down Expand Up @@ -688,6 +695,10 @@ namespace chrono {
} // namespace chrono
_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
16 changes: 13 additions & 3 deletions stl/inc/__msvc_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN
#if _HAS_CXX23
#define _FMT_P2286_BEGIN inline namespace __p2286 {
Expand Down Expand Up @@ -90,7 +96,7 @@ enum class _Basic_format_arg_type : uint8_t {
static_assert(static_cast<int>(_Basic_format_arg_type::_Custom_type) < 16, "must fit in 4-bit bitfield");

#if _HAS_CXX23
_EXPORT_STD template <class _Ty>
_EXPORT_STD template <class _Ty> // specializations allowed by N5014 [format.formatter.locking]/1
constexpr bool enable_nonlocking_formatter_optimization = false;

_NODISCARD consteval bool _Is_debug_enabled_fmt_type(_Basic_format_arg_type _Ty) {
Expand Down Expand Up @@ -126,7 +132,7 @@ struct _Dynamic_format_specs : _Basic_format_specs<_CharT> {
[[noreturn]] inline void _Throw_format_error(const char* _Message);

_EXPORT_STD template <class _CharT>
class basic_format_parse_context;
class _NO_SPECIALIZATIONS_CITING("N5014 [format.parse.ctx]/2") basic_format_parse_context;

template <class _CharT>
concept _Format_supported_charT = _Is_any_of_v<_CharT, char, wchar_t>;
Expand Down Expand Up @@ -328,7 +334,7 @@ struct _Invalid_format_kind {
};

_EXPORT_STD template <class _Ty>
constexpr _Invalid_format_kind<_Ty> format_kind;
constexpr _Invalid_format_kind<_Ty> format_kind; // specializations allowed by N5014 [format.range.fmtkind]/3

template <class _Ty>
constexpr bool _Is_two_tuple = false;
Expand Down Expand Up @@ -442,6 +448,10 @@ struct _Fill_align_and_width_formatter {
#endif // _HAS_CXX23
_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
14 changes: 12 additions & 2 deletions stl/inc/__msvc_iter_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN
template <class _Ty, class _Alloc, class = void>
struct _Has_allocator_type : false_type {}; // tests for suitable _Ty::allocator_type
Expand All @@ -34,7 +40,7 @@ _EXPORT_STD template <class _Ty, class _Alloc>
struct uses_allocator : _Has_allocator_type<_Ty, _Alloc>::type {};

_EXPORT_STD template <class _Ty, class _Alloc>
constexpr bool uses_allocator_v = uses_allocator<_Ty, _Alloc>::value;
_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool uses_allocator_v = uses_allocator<_Ty, _Alloc>::value;

// from <iterator>
_EXPORT_STD struct input_iterator_tag {};
Expand Down Expand Up @@ -406,7 +412,7 @@ concept input_or_output_iterator = requires(_It __i) {
_EXPORT_STD template <class _Se, class _It>
concept sentinel_for = semiregular<_Se> && input_or_output_iterator<_It> && _Weakly_equality_comparable_with<_Se, _It>;

_EXPORT_STD template <class _Se, class _It>
_EXPORT_STD template <class _Se, class _It> // specializations allowed by N5014 [iterator.concept.sizedsentinel]/3
constexpr bool disable_sized_sentinel_for = false;

_EXPORT_STD template <class _Se, class _It>
Expand Down Expand Up @@ -542,6 +548,10 @@ struct _Meta_find_unique_index_<_List<_First, _Rest...>, _Ty> {
};
_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
16 changes: 13 additions & 3 deletions stl/inc/__msvc_ranges_tuple_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN
_EXPORT_STD template <class, class>
class vector;
Expand Down Expand Up @@ -93,7 +99,7 @@ template <class _CharT>
class _Compile_time_parse_context;

_EXPORT_STD template <class _CharT>
class basic_format_parse_context {
class _NO_SPECIALIZATIONS_CITING("N5014 [format.parse.ctx]/2") basic_format_parse_context {
public:
using char_type = _CharT;
using const_iterator = basic_string_view<_CharT>::const_iterator;
Expand Down Expand Up @@ -229,7 +235,7 @@ struct _Format_handler;
_FMT_P2286_END

_EXPORT_STD template <class _Context>
class basic_format_arg {
class _NO_SPECIALIZATIONS_CITING("N5014 [format.arg]/2") basic_format_arg {
public:
using _CharType = _Context::char_type;

Expand Down Expand Up @@ -674,7 +680,7 @@ class _Lazy_locale {

_EXPORT_STD template <class _Out, class _CharT>
requires output_iterator<_Out, const _CharT&>
class basic_format_context {
class _NO_SPECIALIZATIONS_CITING("N5014 [format.context]/2") basic_format_context {
private:
_Out _OutputIt;
basic_format_args<basic_format_context> _Args;
Expand Down Expand Up @@ -1256,6 +1262,10 @@ struct formatter<tuple<_Types...>, _CharT> : _Tuple_formatter_base<tuple<_Types.
#endif // _HAS_CXX23
_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
12 changes: 11 additions & 1 deletion stl/inc/compare
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN
void _Literal_zero_is_expected();

Expand Down Expand Up @@ -321,7 +327,7 @@ using compare_three_way_result_t =
decltype(_STD declval<const remove_reference_t<_Ty1>&>() <=> _STD declval<const remove_reference_t<_Ty2>&>());

_EXPORT_STD template <class _Ty1, class _Ty2 = _Ty1>
struct compare_three_way_result {};
struct _NO_SPECIALIZATIONS_CITING("N5014 [cmp.result]/1") compare_three_way_result {};

template <class _Ty1, class _Ty2>
requires requires { typename compare_three_way_result_t<_Ty1, _Ty2>; }
Expand Down Expand Up @@ -841,6 +847,10 @@ inline namespace _Cpos {
}
_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
14 changes: 12 additions & 2 deletions stl/inc/coroutine
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN

template <class _Ret, class = void>
Expand All @@ -46,7 +52,7 @@ _EXPORT_STD template <class _Ret, class...>
struct coroutine_traits : _Coroutine_traits<_Ret> {};

_EXPORT_STD template <class = void>
struct coroutine_handle;
struct _NO_SPECIALIZATIONS_CITING("N5014 [coroutine.handle.general]/2") coroutine_handle;

template <>
struct coroutine_handle<void> {
Expand Down Expand Up @@ -93,7 +99,7 @@ private:
};

_EXPORT_STD template <class _CoroPromise>
struct coroutine_handle {
struct _NO_SPECIALIZATIONS_CITING("N5014 [coroutine.handle.general]/2") coroutine_handle {
constexpr coroutine_handle() noexcept = default;
constexpr coroutine_handle(nullptr_t) noexcept {}

Expand Down Expand Up @@ -255,6 +261,10 @@ _EXPORT_STD struct suspend_always {

_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
18 changes: 14 additions & 4 deletions stl/inc/functional
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN
// plus, minus, and multiplies are defined in <xutility>

Expand Down Expand Up @@ -301,13 +307,13 @@ _STL_RESTORE_DEPRECATED_WARNING

#if _HAS_AUTO_PTR_ETC
_EXPORT_STD template <class _Arg, class _Result>
struct unary_function { // base class for unary functions
struct _NO_SPECIALIZATIONS_CITING("N4140 [depr.base]/1") unary_function { // base class for unary functions
using argument_type = _Arg;
using result_type = _Result;
};

_EXPORT_STD template <class _Arg1, class _Arg2, class _Result>
struct binary_function { // base class for binary functions
struct _NO_SPECIALIZATIONS_CITING("N4140 [depr.base]/1") binary_function { // base class for binary functions
using first_argument_type = _Arg1;
using second_argument_type = _Arg2;
using result_type = _Result;
Expand Down Expand Up @@ -2008,7 +2014,7 @@ template <class _Tx>
struct is_placeholder<const volatile _Tx> : is_placeholder<_Tx>::type {}; // ignore cv-qualifiers

_EXPORT_STD template <class _Ty>
constexpr int is_placeholder_v = is_placeholder<_Ty>::value;
_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr int is_placeholder_v = is_placeholder<_Ty>::value;

template <class _Ret, class _Fx, class... _Types>
class _Binder;
Expand All @@ -2029,7 +2035,7 @@ template <class _Tx>
struct is_bind_expression<const volatile _Tx> : is_bind_expression<_Tx>::type {}; // ignore cv-qualifiers

_EXPORT_STD template <class _Ty>
constexpr bool is_bind_expression_v = is_bind_expression<_Ty>::value;
_NO_SPECIALIZATIONS_OF_VARIABLE_TEMPLATES constexpr bool is_bind_expression_v = is_bind_expression<_Ty>::value;

template <class _Cv_TiD, bool = _Is_specialization_v<remove_cv_t<_Cv_TiD>, reference_wrapper>,
bool = is_bind_expression_v<_Cv_TiD>, int = is_placeholder_v<_Cv_TiD>>
Expand Down Expand Up @@ -3160,6 +3166,10 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 {

_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
11 changes: 9 additions & 2 deletions stl/inc/generator
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ _STL_DISABLE_CLANG_WARNINGS
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#pragma push_macro("empty_bases")
#undef msvc
#undef no_specializations
#undef empty_bases

_STD_BEGIN
Expand All @@ -40,7 +44,7 @@ template <class _Alloc>
constexpr bool _Stateless_allocator = default_initializable<_Alloc> && allocator_traits<_Alloc>::is_always_equal::value;

_EXPORT_STD template <class _Rty, class _Vty = void, class _Alloc = void>
class generator;
class _NO_SPECIALIZATIONS_CITING("N5014 [coro.generator.class]/4") generator;

namespace _Gen_detail {
template <class _Alloc>
Expand Down Expand Up @@ -518,7 +522,8 @@ namespace _Gen_detail {
} // namespace _Gen_detail

_EXPORT_STD template <class _Rty, class _Vty, class _Alloc>
class generator : public _RANGES view_interface<generator<_Rty, _Vty, _Alloc>> {
class _NO_SPECIALIZATIONS_CITING("N5014 [coro.generator.class]/4") generator
: public _RANGES view_interface<generator<_Rty, _Vty, _Alloc>> {
private:
static_assert(_Gen_detail::_Valid_allocator<_Alloc>,
"generator allocators must use raw pointers (N4988 [coro.generator.class]/1.1)");
Expand Down Expand Up @@ -603,6 +608,8 @@ _STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("empty_bases")
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
Expand Down
13 changes: 12 additions & 1 deletion stl/inc/initializer_list
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ _STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// TRANSITION, non-_Ugly attribute tokens
#pragma push_macro("msvc")
#pragma push_macro("no_specializations")
#undef msvc
#undef no_specializations

_STD_BEGIN
_EXPORT_STD template <class _Elem>
class initializer_list {
class _NO_SPECIALIZATIONS_CITING("N5014 [initializer.list.syn]/2") initializer_list {
public:
using value_type = _Elem;
using reference = const _Elem&;
Expand Down Expand Up @@ -60,6 +66,11 @@ _NODISCARD constexpr const _Elem* end(initializer_list<_Elem> _Ilist) noexcept {
return _Ilist.end();
}
_STD_END

// TRANSITION, non-_Ugly attribute tokens
#pragma pop_macro("no_specializations")
#pragma pop_macro("msvc")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
Loading