public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98030] New: error message for enum definition without ';' could be improved
@ 2020-11-27 13:18 tangyixuan at mail dot dlut.edu.cn
2020-11-27 13:25 ` [Bug c++/98030] " rguenth at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: tangyixuan at mail dot dlut.edu.cn @ 2020-11-27 13:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98030
Bug ID: 98030
Summary: error message for enum definition without ';' could be
improved
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tangyixuan at mail dot dlut.edu.cn
Target Milestone: ---
Hi, the following code misses a ';' at the end of the enum definition. GCC
reports an error with 'new types may not be defined', which may not be easily
understood by novices, while clang suggests the additional ';' could be better.
$ cat s.cpp
enum E {
e = 3,
} //miss a ';' here
int main() {
bool var1 = e;
bool var2 = 3;
}
$ g++ -c s.cpp
s.cpp:1:1: error: new types may not be defined in a return type
1 | enum E {
| ^~~~
s.cpp:1:1: note: (perhaps a semicolon is missing after the definition of ‘E’)
s.cpp:1:1: error: two or more data types in declaration of ‘main’
$ clang++ -c s.cpp
s.cpp:3:2: error: expected ';' after enum
}
^
;
1 error generated.
$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-20201122/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-20201122/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-11-20201122/configure --prefix=/usr/local/gcc-20201122
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201122 (experimental) (GCC)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/98030] error message for enum definition without ';' could be improved
2020-11-27 13:18 [Bug c++/98030] New: error message for enum definition without ';' could be improved tangyixuan at mail dot dlut.edu.cn
@ 2020-11-27 13:25 ` rguenth at gcc dot gnu.org
2020-11-28 1:43 ` egallager at gcc dot gnu.org
2021-11-25 22:12 ` [Bug c++/98030] error message for enum definition without ';' could be improved to include a fixit note pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-27 13:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98030
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
s.cpp:1:1: note: (perhaps a semicolon is missing after the definition of ‘E’)
so it says that.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/98030] error message for enum definition without ';' could be improved
2020-11-27 13:18 [Bug c++/98030] New: error message for enum definition without ';' could be improved tangyixuan at mail dot dlut.edu.cn
2020-11-27 13:25 ` [Bug c++/98030] " rguenth at gcc dot gnu.org
@ 2020-11-28 1:43 ` egallager at gcc dot gnu.org
2021-11-25 22:12 ` [Bug c++/98030] error message for enum definition without ';' could be improved to include a fixit note pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: egallager at gcc dot gnu.org @ 2020-11-28 1:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98030
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> s.cpp:1:1: note: (perhaps a semicolon is missing after the definition of ‘E’)
>
> so it says that.
A fixit that can be used with all the fixit-related machinery would still be
more useful though.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/98030] error message for enum definition without ';' could be improved to include a fixit note
2020-11-27 13:18 [Bug c++/98030] New: error message for enum definition without ';' could be improved tangyixuan at mail dot dlut.edu.cn
2020-11-27 13:25 ` [Bug c++/98030] " rguenth at gcc dot gnu.org
2020-11-28 1:43 ` egallager at gcc dot gnu.org
@ 2021-11-25 22:12 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-25 22:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98030
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|error message for enum |error message for enum
|definition without ';' |definition without ';'
|could be improved |could be improved to
| |include a fixit note
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-11-25
Severity|normal |enhancement
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-25 22:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 13:18 [Bug c++/98030] New: error message for enum definition without ';' could be improved tangyixuan at mail dot dlut.edu.cn
2020-11-27 13:25 ` [Bug c++/98030] " rguenth at gcc dot gnu.org
2020-11-28 1:43 ` egallager at gcc dot gnu.org
2021-11-25 22:12 ` [Bug c++/98030] error message for enum definition without ';' could be improved to include a fixit note pinskia 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).