https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882
Bug ID: 71882 Summary: elaborated-type-specifier friend not looked up in unnamed namespace Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sbergman at redhat dot com Target Milestone: --- At least with both GCC 6.1.1 and recent trunk, compiling namespace { struct S; } class C { friend struct S; static void f(); }; namespace { struct S { void f() { C::f(); } }; } fails with > $ g++ -c test.cc > test.cc: In member function ‘void {anonymous}::S::f()’: > test.cc:6:42: error: ‘static void C::f()’ is private within this context > namespace { struct S { void f() { C::f(); } }; } > ^ > test.cc:4:17: note: declared private here > static void f(); > ^