-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang][Sema] Abbreviated function templates do not append invented p…
…arameters to empty template parameter lists (#80864) According to [dcl.fct] p23: > An abbreviated function template can have a _template-head_. The invented _template-parameters_ are appended to the _template-parameter-list_ after the explicitly declared _template-parameters_. `template<>` is not a _template-head_ -- a _template-head_ must have at least one _template-parameter_. This patch corrects our current behavior of appending the invented template parameters to the innermost template parameter list, regardless of whether it is empty. Example: ``` template<typename T> struct A { void f(auto); }; template<> void A<int>::f(auto); // ok template<> template<> // warning: extraneous template parameter list in template specialization void A<int>::f(auto); ```
- Loading branch information
1 parent
abc4f74
commit 17f0680
Showing
8 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// RUN: %clang_cc1 -std=c++20 -pedantic-errors -verify %s | ||
|
||
// FIXME: This should be an error with -pedantic-errors. | ||
template<> // expected-warning {{extraneous template parameter list in template specialization}} | ||
void f(auto); | ||
|
||
template<typename> | ||
void f(auto); | ||
|
||
template<typename T> | ||
struct A { | ||
void g(auto); | ||
}; | ||
|
||
template<typename T> | ||
void A<T>::g(auto) { } | ||
|
||
template<> | ||
void A<int>::g(auto) { } | ||
|
||
// FIXME: This should be an error with -pedantic-errors. | ||
template<> | ||
template<> // expected-warning {{extraneous template parameter list in template specialization}} | ||
void A<long>::g(auto) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters