template <typename T> struct Foo { template <typename Z> friend void func(const Foo &); };
void check(const Foo<int> & x) { Foo<int> weird; func<int>(x); } func is incorrectly found by name-lookup. If you delete the declaration of weird the program is rejected as it should. Maybe we are confused by applying argument dependent name-lookup here? -- Summary: Weird name-lookup error Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34827