http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51257
Bug #: 51257 Summary: Template changes scope of friend functions Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: pubb...@gmail.com gcc version 4.7.0 20111112 (experimental) (GCC) Unsure about this: struct foo { friend void f1() { } template <int x = 0> friend void f2() { } }; int main(){ f1(); // doesn't compile f2(); // compiles, seems like it shouldn't }