public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101526] New: Improve diagnostic for trailing comma in base-clause in class-head
@ 2021-07-20 12:24 redi at gcc dot gnu.org
2021-07-20 13:27 ` [Bug c++/101526] " mpolacek at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-20 12:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101526
Bug ID: 101526
Summary: Improve diagnostic for trailing comma in base-clause
in class-head
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: ---
struct A { };
struct B : A, { };
GCC correctly says:
base.C:2:15: error: expected class-name before ‘{’ token
2 | struct B : A, { };
| ^
It would be nice if we offered a fix-it hint to remove the trailing comma.
This can easily happen when refactoring code if you remove the last base-class
from a list of several. When each base is on its own line, the location printed
is not helpful:
struct Base_class_one { };
struct Base_class_two_with_long_name { };
struct Claaaaaas
: Base_class_one,
Base_class_two_with_long_name,
// Removed_base_class
{
};
base.C:7:1: error: expected class-name before ‘{’ token
7 | {
| ^
This would be much better if it pointed to the trailing comma, and suggested
removing it.
See also PR 101519 which requests another improvement to the same diagnostic,
but with a different cause.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/101526] Improve diagnostic for trailing comma in base-clause in class-head
2021-07-20 12:24 [Bug c++/101526] New: Improve diagnostic for trailing comma in base-clause in class-head redi at gcc dot gnu.org
@ 2021-07-20 13:27 ` mpolacek at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-07-20 13:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101526
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2021-07-20
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-20 13:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 12:24 [Bug c++/101526] New: Improve diagnostic for trailing comma in base-clause in class-head redi at gcc dot gnu.org
2021-07-20 13:27 ` [Bug c++/101526] " mpolacek 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).