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 9template <class T> struct A { 10 template <class U> void f(U); // { dg-error "candidate" } 11 void g(); // { dg-error "candidate|with" } 12 void h(); // { dg-error "candidate|with" } 13 void i(int); // { dg-error "candidate" } 14}; 15 16class 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|cannot be overloaded" } 21 template <class U> friend int A<U>::h(); // { dg-error "not match|cannot be overloaded" } 22 template <class U> friend void A<U>::i(char); // { dg-error "not match" } 23}; 24