------- Comment #4 from dgregor at gcc dot gnu dot org 2008-01-15 00:43 ------- So, this is another case where we have a bug in our handling of C++98 that just happens to have been reported against variadic templates. The error in the code example is that 'N' in the friend declaration needs to be a parameter pack, e.g.,
template<int... N> friend void A<N...>::A::foo(); That way, we're exactly matching the signature of the template A. The problem, in the compiler, is that without this exact match we don't get to the primary template's definition, and when we can't find A<N>::A we end up with a TYPENAME_TYPE... not the kind of thing we want at this point. In C++98, we can create the same issue by using non-type template parameters that don't match types exactly, e.g., template<int> struct X { void foo(); }; struct Y { template<long N> friend void X<N>::X::foo(); }; That causes the same kind of ICE. I'm looking into this issue now... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34399