Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / g++.dg / template / memfriend1.C
blobf4541279c8ba5e4e96ca03b1d5d47e4a429297bf
1 // { dg-do compile }
3 // Copyright (C) 2003 Free Software Foundation
4 // Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
6 // Member function of class template as friend
8 template<class T> struct A
10   void f();
13 class C {
14   int i;
15   template<class T> friend void A<T>::f();
18 template<class T> struct A<T*>
20   void f();
23 template<> struct A<char>
25   void f();
28 template<class T> void A<T>::f()
30   C c;
31   c.i = 0;
34 template<class T> void A<T*>::f()
36   C c;
37   c.i = 0;
40 void A<char>::f()
42   C c;
43   c.i = 0;
46 int main()
48   A<int> a1;
49   a1.f();
50   A<int *> a2;
51   a2.f();
52   A<char> a3;
53   a3.f();