Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / g++.dg / tc1 / dr166.C
blobcc4631a5f38a349cb1f2203015f96cfb2e239c48
1 // { dg-do compile }
2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR166: Friend declarations of template-ids 
5 namespace N {
6   template <class T> void f(T);
7   void g();
9   namespace M {
10     class A {
11       friend void f<int>(int); // N::f
12       static int x;   // { dg-error "private" }
13     };
14     
15     class B {
16       template <class T> friend void f(T);  // M::f
17       static int x;   // { dg-error "private" }
18     };
20     class C {
21       friend void g(); // M::g
22       static int x;   // { dg-error "private" }
23     };
25     template <class T> void f(T)  // will be instantiated as f<long>
26     {
27       M::A::x = 0;    // { dg-error "within this context" }
28       M::B::x = 0;
29     }
30     template <> void f<int>(int)
31     { M::A::x = 0; }      // { dg-error "within this context" }
32     template <> void f<double>(double )
33     { 
34       M::B::x = 0; 
35       M::f<long>(0);   // { dg-error "instantiated" }
36     }
38     void g(void)
39     { M::C::x = 0; }
40   }
42   template <class T> void f(T)  // will be instantiated as f<long>
43   { 
44     M::A::x = 0;       // { dg-error "within this context" }
45     M::B::x = 0;       // { dg-error "within this context" }
46   }
48   template <> void f<int>(int )
49   { 
50     N::f<long>(0);        // { dg-error "instantiated" }
51     M::A::x = 0; 
52     M::B::x = 0;       // { dg-error "within this context" }
53   }
55   template <> void f<char>(char )
56   { M::A::x = 0; }      // { dg-error "within this context" }
58   void g(void)
59   { M::C::x = 0; }      // { dg-error "within this context" }