https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95180
Bug ID: 95180 Summary: Failure to reject invalid code with attempted redefinition of symbol with different linkage 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: --- void g(int i) { extern int i; } `extern int i;` redefines the `i` parameter and is thus invalid (Clang also rejects it). This is not warned about by `-std=c++20 -pedantic-errors` so I'll assume this is a bug, rather than some part of GNU C++. Furthermore, GCC correctly rejects void g(int i) { int i; } , so this really looks like a bug to me.