File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,15 @@ C++ Specific Potentially Breaking Changes
6565 `-Wno-enum-constexpr-conversion `, to allow for a transition period for users.
6666 Now, in Clang 20, **it is no longer possible to suppress the diagnostic **.
6767
68+ - Extraneous template headers are now ill-formed by default.
69+ This error can be disable with ``-Wno-error=extraneous-template-head ``.
70+
71+ .. code-block :: c++
72+
73+ template <> // error: extraneous template head
74+ template <typename T>
75+ void f();
76+
6877ABI Changes in This Version
6978---------------------------
7079
Original file line number Diff line number Diff line change @@ -5428,7 +5428,8 @@ def err_template_spec_extra_headers : Error<
54285428 "extraneous template parameter list in template specialization or "
54295429 "out-of-line template definition">;
54305430def ext_template_spec_extra_headers : ExtWarn<
5431- "extraneous template parameter list in template specialization">;
5431+ "extraneous template parameter list in template specialization">,
5432+ InGroup<DiagGroup<"extraneous-template-head">>, DefaultError;
54325433def note_explicit_template_spec_does_not_need_header : Note<
54335434 "'template<>' header not required for explicitly-specialized class %0 "
54345435 "declared here">;
Original file line number Diff line number Diff line change @@ -18,14 +18,13 @@ This test serves two purposes:
1818
1919The list of warnings below should NEVER grow . It should gradually shrink to 0.
2020
21- CHECK : Warnings without flags (65 ):
21+ CHECK : Warnings without flags (64 ):
2222
2323CHECK - NEXT : ext_expected_semi_decl_list
2424CHECK - NEXT : ext_missing_whitespace_after_macro_name
2525CHECK - NEXT : ext_new_paren_array_nonconst
2626CHECK - NEXT : ext_plain_complex
2727CHECK - NEXT : ext_template_arg_extra_parens
28- CHECK - NEXT : ext_template_spec_extra_headers
2928CHECK - NEXT : ext_typecheck_cond_incompatible_operands
3029CHECK - NEXT : ext_typecheck_ordered_comparison_of_pointer_integer
3130CHECK - NEXT : ext_using_undefined_std
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat %s
22// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat -std=c++98 %s
33// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++11 %s
4+ // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++20 %s
45//
56// Tests explicit instantiation of templates.
67template <typename T, typename U = T> class X0 { };
@@ -128,11 +129,15 @@ struct Foo<int> // expected-note{{header not required for explicitly-specialized
128129 {};
129130};
130131
131- template <> // expected-warning {{extraneous template parameter list}}
132+ template <> // expected-error {{extraneous template parameter list}}
132133template <>
133134struct Foo <int >::Bar<void >
134135{};
135136
137+ #if __cplusplus >= 202002L
138+ template <> void f (auto ); // expected-error{{extraneous template parameter list}}
139+ #endif
140+
136141namespace N1 {
137142
138143 template <typename T> struct X7 { }; // expected-note{{here}}
You can’t perform that action at this time.
0 commit comments