https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96120
Bug ID: 96120 Summary: Ambiguity diagnostic message of "invalid use of type 'void' in parameter declaration" Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- Hi, all. This code, test.cc, GCC might emit the ambiguity diagnostic message on it. $cat test.cc void foo1 (void) {} void foo2 (void, int){} $g++ -c test.cc test.cc:2:12: error: invalid use of type ‘void’ in parameter declaration 2 | void foo2 (void, int){} | ^~~~ Apparently, "void" can be used in parameter declaration like line 1, but GCC emits the ambiguity message on it. The output information conflicts with valid grammar, so I guess users might be confused with this diagnostic. I think clang handles better in this case $clang++ -c test.cc test.cc:2:11: error: 'void' must be the first and only parameter if specified void foo2 (void, int){} ^ 1 error generated. Thanks, Haoxin