// { 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(); }; }; template 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::f() { C c; c.i = 0; } int main() { A::B b1; b1.f(); A::B b2; b2.f(); A::B b3; b3.f(); A::B b4; b4.f(); }