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.