summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/memfriend6.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/template/memfriend6.C')
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend6.C23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/memfriend6.C b/gcc/testsuite/g++.dg/template/memfriend6.C
new file mode 100644
index 000000000..5f82339af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend6.C
@@ -0,0 +1,23 @@
+// { 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 {
+ template <class U> void f(U); // { dg-error "candidate" }
+ void g(); // { dg-error "candidate|with" }
+ void h(); // { dg-error "candidate|with" }
+ void i(int); // { dg-error "candidate" }
+};
+
+class C {
+ int ii;
+ template <class U> friend void A<U>::f(U); // { dg-error "not match" }
+ template <class U> template <class V>
+ friend void A<U>::g(); // { dg-error "not match|cannot be overloaded" }
+ template <class U> friend int A<U>::h(); // { dg-error "not match|cannot be overloaded" }
+ template <class U> friend void A<U>::i(char); // { dg-error "not match" }
+};