http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45942
--- Comment #3 from Michiel <MichieldeB at aim dot com> 2010-10-08 14:51:36 UTC --- (In reply to comment #1) > It's not entirely clear what you're saying is a bug, because your testcase > doesn't give any error. > > It's more helpful to provide the source code that you claim produces the bug. > I assume you this: > > template <class T, int C> class classA; > > template <class T, int C, classA<T,C> &instanceA> class classB; > > template <class T, int C> class classA > { > // incorrect error message: partial specialization claimed but not apparent > template <classA &instanceA> friend class classB<T,C,instanceA>; > > private: > int for_use_by_classB; > > }; > > template <class T, int C, classA<T,C> &instanceA> class classB > { > > classB (int i) { instanceA.for_use_by_classB = i; } > > }; > > // instantiation > template class classA<char,128>; > > > That code is not valid, the error is not incorrect. > > You have declared classB as a friend, and as a template with one template > parameter, instanceA, and the template arguments <T,C,instanceA>. That is a > partial specialization. Apparently you are making the same mistake as the compiler. In the friend class declaration, the third parameter is not free, indeed, but its specialization level does not exceed that of the class definition of class classB. Thus the friend declaration is no specialization in the proper relative sense. If you still do not agree, just provide code that makes classB a friend of classA. That is what I want.