File tree 4 files changed +18
-4
lines changed
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
65
65
`-Wno-enum-constexpr-conversion `, to allow for a transition period for users.
66
66
Now, in Clang 20, **it is no longer possible to suppress the diagnostic **.
67
67
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
+
68
77
ABI Changes in This Version
69
78
---------------------------
70
79
Original file line number Diff line number Diff line change @@ -5428,7 +5428,8 @@ def err_template_spec_extra_headers : Error<
5428
5428
"extraneous template parameter list in template specialization or "
5429
5429
"out-of-line template definition">;
5430
5430
def 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;
5432
5433
def note_explicit_template_spec_does_not_need_header : Note<
5433
5434
"'template<>' header not required for explicitly-specialized class %0 "
5434
5435
"declared here">;
Original file line number Diff line number Diff line change @@ -18,14 +18,13 @@ This test serves two purposes:
18
18
19
19
The list of warnings below should NEVER grow . It should gradually shrink to 0.
20
20
21
- CHECK : Warnings without flags (65 ):
21
+ CHECK : Warnings without flags (64 ):
22
22
23
23
CHECK - NEXT : ext_expected_semi_decl_list
24
24
CHECK - NEXT : ext_missing_whitespace_after_macro_name
25
25
CHECK - NEXT : ext_new_paren_array_nonconst
26
26
CHECK - NEXT : ext_plain_complex
27
27
CHECK - NEXT : ext_template_arg_extra_parens
28
- CHECK - NEXT : ext_template_spec_extra_headers
29
28
CHECK - NEXT : ext_typecheck_cond_incompatible_operands
30
29
CHECK - NEXT : ext_typecheck_ordered_comparison_of_pointer_integer
31
30
CHECK - NEXT : ext_using_undefined_std
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat %s
2
2
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat -std=c++98 %s
3
3
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++11 %s
4
+ // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++20 %s
4
5
//
5
6
// Tests explicit instantiation of templates.
6
7
template <typename T, typename U = T> class X0 { };
@@ -128,11 +129,15 @@ struct Foo<int> // expected-note{{header not required for explicitly-specialized
128
129
{};
129
130
};
130
131
131
- template <> // expected-warning {{extraneous template parameter list}}
132
+ template <> // expected-error {{extraneous template parameter list}}
132
133
template <>
133
134
struct Foo <int >::Bar<void >
134
135
{};
135
136
137
+ #if __cplusplus >= 202002L
138
+ template <> void f (auto ); // expected-error{{extraneous template parameter list}}
139
+ #endif
140
+
136
141
namespace N1 {
137
142
138
143
template <typename T> struct X7 { }; // expected-note{{here}}
You can’t perform that action at this time.
0 commit comments