https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77892
Bug ID: 77892 Summary: local function declarations don't match namespace scope declarations Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jeff.mirwaisi at gmail dot com Target Milestone: --- //error: undefined reference to 'f()' struct S{friend void f(){}}; //lexical scope of S, only discoverable via ADL, no //argument, so not discoverable at all yet void f(); //make f visible to ordinary qualified lookup int main() { void f(); //declaration should match the declaration at namespace scope, instead //hides the previous declaration at namespace scope f(); } //open question whether a local scope declaration is enough to make a class scope //friend function visible to ordinary lookup //works in clang not in gcc struct S{friend void f(){}}; int main() { void f(); f(); }