OSDN Git Service

PR c++/28878
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / memfriend6.C
1 // { dg-do compile }
2
3 // Copyright (C) 2003 Free Software Foundation
4 // Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
5
6 // Member function of class template as friend
7 // Erroneous case: mismatch during declaration
8
9 template <class T> struct A {
10   template <class U> void f(U);         // { dg-error "candidate" }
11   void g();                             // { dg-error "candidate" }
12   void h();                             // { dg-error "candidate" }
13   void i(int);                          // { dg-error "candidate" }
14 };
15
16 class C {
17   int ii;
18   template <class U> friend void A<U>::f(U);    // { dg-error "not match" }
19   template <class U> template <class V>
20     friend void A<U>::g();                      // { dg-error "not match" }
21   template <class U> friend int A<U>::h();      // { dg-error "not match" }
22   template <class U> friend void A<U>::i(char); // { dg-error "not match" }
23 };