public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107408] New: Inaccurate "error: too many template-parameter-lists" diagnostic for missing template argument list
@ 2022-10-26 8:39 redi at gcc dot gnu.org
2022-10-26 8:39 ` [Bug c++/107408] " redi at gcc dot gnu.org
2022-10-26 8:40 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-26 8:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107408
Bug ID: 107408
Summary: Inaccurate "error: too many template-parameter-lists"
diagnostic for missing template argument list
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
template<class T> struct S
{
template<class U> S(U);
};
template<class T> template<class U> S::S(U) { }
This prints:
t.C:6:38: error: too many template-parameter-lists
6 | template<class T> template<class U> S::S(U) { }
| ^~
The caret is in the right location, but the diagnostic message is misleading.
The problem is a missing template argument list, it should be S<T>::S(U)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107408] Inaccurate "error: too many template-parameter-lists" diagnostic for missing template argument list
2022-10-26 8:39 [Bug c++/107408] New: Inaccurate "error: too many template-parameter-lists" diagnostic for missing template argument list redi at gcc dot gnu.org
@ 2022-10-26 8:39 ` redi at gcc dot gnu.org
2022-10-26 8:40 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-26 8:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107408
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Clang prints three errors. The first one hints at the real problem, but the
next two are bogus:
t.C:6:37: error: 'S' is not a class, namespace, or enumeration
template<class T> template<class U> S::S(U) { }
^
t.C:1:26: note: 'S' declared here
template<class T> struct S
^
t.C:6:1: error: extraneous template parameter list in template specialization
or out-of-line template definition
template<class T> template<class U> S::S(U) { }
^~~~~~~~~~~~~~~~~
t.C:6:48: error: expected ';' at end of declaration
template<class T> template<class U> S::S(U) { }
^
;
3 errors generated.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/107408] Inaccurate "error: too many template-parameter-lists" diagnostic for missing template argument list
2022-10-26 8:39 [Bug c++/107408] New: Inaccurate "error: too many template-parameter-lists" diagnostic for missing template argument list redi at gcc dot gnu.org
2022-10-26 8:39 ` [Bug c++/107408] " redi at gcc dot gnu.org
@ 2022-10-26 8:40 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-26 8:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107408
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
EDG gets it right:
"t.C", line 6: error: name followed by "::" must be a class or namespace name
template<class T> template<class U> S::S(U) { }
^
"t.C", line 6: error: argument list for class template "S" is missing
template<class T> template<class U> S::S(U) { }
^
2 errors detected in the compilation of "t.C".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-26 8:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26 8:39 [Bug c++/107408] New: Inaccurate "error: too many template-parameter-lists" diagnostic for missing template argument list redi at gcc dot gnu.org
2022-10-26 8:39 ` [Bug c++/107408] " redi at gcc dot gnu.org
2022-10-26 8:40 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).