2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / template / memfriend2.C
blob364ad7d78645eb3d8fe88f045f34daa1f10c33e5
1 // { dg-do compile }
3 // Copyright (C) 2003 Free Software Foundation
4 // Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
6 // Member function template of class template as friend
8 template <class T> struct A
10   template <class U> void f();
13 class C {
14   int i;
15   template <class T> template <class U> friend void A<T>::f();
18 template <class T> struct A<T*>
20   template <class U> void f();
23 template <> struct A<char>
25   template <class U> void f();
28 template <class T> template <class U> void A<T>::f()
30   C c;
31   c.i = 0;
34 template <class T> template <class U> void A<T*>::f()
36   C c;
37   c.i = 0;
40 template <class U> void A<char>::f()
42   C c;
43   c.i = 0;
46 template <> void A<char>::f<int>()
48   C c;
49   c.i = 0;
52 int main()
54   A<int> a1;
55   a1.f<char>();
56   A<int *> a2;
57   a2.f<char>();
58   A<char> a3;
59   a3.f<char>();
60   a3.f<int>();