2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR166: Friend declarations of template-ids
6 template <class T> void f(T);
11 friend void f<int>(int); // N::f
12 static int x; // { dg-error "private" }
16 template <class T> friend void f(T); // M::f
17 static int x; // { dg-error "private" }
21 friend void g(); // M::g
22 static int x; // { dg-error "private" }
25 template <class T> void f(T) // will be instantiated as f<long>
27 M::A::x = 0; // { dg-error "within this context" }
30 template <> void f<int>(int)
31 { M::A::x = 0; } // { dg-error "within this context" }
32 template <> void f<double>(double )
35 M::f<long>(0); // { dg-error "instantiated" }
42 template <class T> void f(T) // will be instantiated as f<long>
44 M::A::x = 0; // { dg-error "within this context" }
45 M::B::x = 0; // { dg-error "within this context" }
48 template <> void f<int>(int )
50 N::f<long>(0); // { dg-error "instantiated" }
52 M::B::x = 0; // { dg-error "within this context" }
55 template <> void f<char>(char )
56 { M::A::x = 0; } // { dg-error "within this context" }
59 { M::C::x = 0; } // { dg-error "within this context" }