// { dg-do compile } // Copyright (C) 2004 Free Software Foundation // Contributed by Kriang Lerdsuwanakij // Nested class template of class template as friend template struct A { template struct B { void f(); }; }; class C { int i; template template friend struct A::B; }; template struct A { template struct B { void f(); }; }; template<> struct A { template struct B { void f(); }; }; template template void A::B::f() { C c; c.i = 0; } template template void A::B::f() { C c; c.i = 0; } template void A::B::f() { C c; c.i = 0; } template <> void A::B<'b'>::f() { C c; c.i = 0; } int d2 = 0; int main() { A::B<0> b1; b1.f(); A::B<&d2> b2; b2.f(); A::B<'a'> b3; b3.f(); A::B<'b'> b4; b4.f(); }