summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/memfriend6.C
blob: 4f1268626706484d1ac4ba363683b5da58fc1336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// { dg-do compile }

// Copyright (C) 2003 Free Software Foundation
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>

// Member function of class template as friend
// Erroneous case: mismatch during declaration

template <class T> struct A { // { dg-message "defined here" }
  template <class U> void f(U);		// { dg-message "candidate" }
  void g();				// { dg-message "candidate" }
  void h();				// { dg-message "candidate" }
  void i(int);				// { dg-message "candidate" }
};

class C {
  int ii;
  template <class U>
  friend void A<U>::f(U); // { dg-error "no declaration matches" }
  template <class U> template <class V>
    friend void A<U>::g();  // { dg-error "no declaration matches" }
  template <class U>
  friend int A<U>::h();	// { dg-error "no declaration matches" }
  template <class U>
  friend void A<U>::i(char);	// { dg-error "no declaration matches" }
};