public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114006] New: False positive diagnostic -Wpedantic for zero-size arrays, most vexing parse
@ 2024-02-20 8:46 janschultke at googlemail dot com
2024-02-20 8:55 ` [Bug c++/114006] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: janschultke at googlemail dot com @ 2024-02-20 8:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114006
Bug ID: 114006
Summary: False positive diagnostic -Wpedantic for zero-size
arrays, most vexing parse
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: janschultke at googlemail dot com
Target Milestone: ---
I got a false positive warning when compiling LLVM with g++. Here is a minimal
repro:
struct string {
const char* data;
string operator+(const char*);
};
int LLVMFuzzerInitialize(int*, char***argv) {
string ExitOnErr(string(*argv[0]) + ": error:");
return 0;
}
<source>: In function 'int LLVMFuzzerInitialize(int*, char***)':
<source>:7:35: warning: ISO C++ forbids zero-size array 'argv' [-Wpedantic]
7 | string ExitOnErr(string(*argv[0]) + ": error:");
|
It looks like GCC thinks that this is a most vexing parse; i.e. it thinks that
argv[0] is a declarator, not a subscript operator. This cannot be correct
because the next expression is + ": error" so this cannot be parsed as a
function declaration.
I suspect that the diagnostic for zero-size arrays is prematurely emitted,
before it's actually known whether this is a function declaration or not.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/114006] False positive diagnostic -Wpedantic for zero-size arrays, most vexing parse
2024-02-20 8:46 [Bug c++/114006] New: False positive diagnostic -Wpedantic for zero-size arrays, most vexing parse janschultke at googlemail dot com
@ 2024-02-20 8:55 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-20 8:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114006
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.
*** This bug has been marked as a duplicate of bug 61259 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-20 8:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 8:46 [Bug c++/114006] New: False positive diagnostic -Wpedantic for zero-size arrays, most vexing parse janschultke at googlemail dot com
2024-02-20 8:55 ` [Bug c++/114006] " 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).