https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81608
Bug ID: 81608 Summary: incompatible declarations of the same extern function at different scopes accepted Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- G++ silently accepts the following ill-formed program that declares the same function with three different return types. Clang and GCC (in C mode) correctly detect the mismatch and reject the program expected. $ cat t.C && gcc -S -Wall -Wextra -Wpedantic t.C int f (void) { extern int g (void); return g (); } void* h (void) { extern void* g (void); return g (); } void g (void) { }