This code should be legal: template <typename T> struct Foo { template <typename Z> friend void func(const Foo &) {} };
void check(const Foo<int> & x) { // Foo<int> weird; // uncomment this line and all works func<int>(x); // <-- GCC issues an ERROR } After a brief discussion on [EMAIL PROTECTED], it has been concluded that this sample code should work. Apparently, 'func' should have been found by argument-dependent lookup, instantiating 'Foo<int>' in the process. Here are links to backup these claims, as specified in the discussion by people involved: - C++ Standard - 3.4.2 [basic.lookup.koenig] - 14.6.5 [temp.inject] - 7.3.1.2 [namespace.memdef] p3 - Vandevoorde and Josuttis' C++ Templates, section 9.2.2 - http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#34 ([EMAIL PROTECTED] thread 'A simple sample code involving templates, friends and lookup') -- Summary: template not instantiated for argument-dependent lookup Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dragan at plusplus dot co dot yu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34870