public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99163] New: Odd error message when using `main` with -pedantic-errors
@ 2021-02-19 12:24 gabravier at gmail dot com
2021-02-19 14:05 ` [Bug c++/99163] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: gabravier at gmail dot com @ 2021-02-19 12:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99163
Bug ID: 99163
Summary: Odd error message when using `main` with
-pedantic-errors
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
int main()
{
main();
}
With -pedantic-errors, this results in this error message:
error: ISO C++ forbids taking address of function ‘::main’ [-Wpedantic]
As far as I am aware, function calls can be done without the function type
decaying to a function pointer type, so this isn't even pedantically accurate.
I believe GCC instead should give an error message alike to "error: ISO C++
forbids usage of main within a program" or something similar, instead of the
currently at least somewhat confusing error message (which had me convinced for
a few minutes that C++ implicitly decayed function types to function pointer
types before calling them until I checked the standard).
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/99163] Odd error message when using `main` with -pedantic-errors
2021-02-19 12:24 [Bug c++/99163] New: Odd error message when using `main` with -pedantic-errors gabravier at gmail dot com
@ 2021-02-19 14:05 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2021-02-19 14:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99163
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-02-19
Keywords| |diagnostic
Ever confirmed|0 |1
Severity|normal |minor
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, the diagnostic could be more accurate.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-19 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 12:24 [Bug c++/99163] New: Odd error message when using `main` with -pedantic-errors gabravier at gmail dot com
2021-02-19 14:05 ` [Bug c++/99163] " 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).