https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111174
Bug ID: 111174 Summary: G++ allows re-declaring function parameters as functions 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: --- ## Code to Reproduce void foo(int x) { void x(int); } ## Expected Output The expected output is emitted in C mode, and also by clang in C/C++ mode (https://godbolt.org/z/b8Gbj69Kn) <source>: In function 'foo': <source>:2:10: error: 'x' redeclared as different kind of symbol 2 | void x(int); | ^ <source>:1:14: note: previous definition of 'x' with type 'int' 1 | void foo(int x) { | ~~~~^ ## Actual Output (only in C++ mode) Compiles. ## Explanation There is no wording in the standard that allows function declarations to redeclare function parameters. This erroneous behavior only occurs for redeclaring function parameters; local/global variables seem unaffected.