public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101519] New: Improve diagnostic for template name used as base class
@ 2021-07-19 19:57 redi at gcc dot gnu.org
2021-07-19 20:00 ` [Bug c++/101519] " mpolacek at gcc dot gnu.org
2021-07-20 12:25 ` redi at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-19 19:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101519
Bug ID: 101519
Summary: Improve diagnostic for template name used as base
class
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
template<typename T> struct A { };
template<typename T> struct B : A { };
a.C:2:35: error: expected class-name before ‘{’ token
2 | template<typename T> struct B : A { };
| ^
While the error is technically correct, it would be more helpful to point out
that a template argument list is expected.
Clang does not better than GCC:
a.C:2:33: error: expected class name
template<typename T> struct B : A { };
^
1 error generated.
But EDG does well:
"a.C", line 2: error: argument list for class template "A" is missing
template<typename T> struct B : A { };
^
"a.C", line 2: error: not a class or struct name
template<typename T> struct B : A { };
^
2 errors detected in the compilation of "a.C".
I think the current error would be fine if it was followed by a note:
note: 'A' is a class template; add a template argument list to use it as a
base-class
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/101519] Improve diagnostic for template name used as base class
2021-07-19 19:57 [Bug c++/101519] New: Improve diagnostic for template name used as base class redi at gcc dot gnu.org
@ 2021-07-19 20:00 ` mpolacek at gcc dot gnu.org
2021-07-20 12:25 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-07-19 20:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101519
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2021-07-19
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/101519] Improve diagnostic for template name used as base class
2021-07-19 19:57 [Bug c++/101519] New: Improve diagnostic for template name used as base class redi at gcc dot gnu.org
2021-07-19 20:00 ` [Bug c++/101519] " mpolacek at gcc dot gnu.org
@ 2021-07-20 12:25 ` redi at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-20 12:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101519
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
See also PR 101526 which requests another improvement to the same diagnostic,
but with a different cause.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-20 12:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 19:57 [Bug c++/101519] New: Improve diagnostic for template name used as base class redi at gcc dot gnu.org
2021-07-19 20:00 ` [Bug c++/101519] " mpolacek at gcc dot gnu.org
2021-07-20 12:25 ` 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).