re PR c++/42328 (rejects valid friend)
authorPaolo Carlini <paolo.carlini@oracle.com>
Sat, 28 Mar 2015 10:28:14 +0000 (10:28 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 28 Mar 2015 10:28:14 +0000 (10:28 +0000)
2015-03-28  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/42328
* g++.dg/template/friend58.C: New.
* g++.dg/template/friend59.C: Likewise.

From-SVN: r221751

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/friend58.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/friend59.C [new file with mode: 0644]

index d94f5a12b53ab10e2ef3f5479cac329408a6045e..0e4c56cf8adbcc760d46bcbe635c0a47fbe6b776 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/42328
+       * g++.dg/template/friend58.C: New.
+       * g++.dg/template/friend59.C: Likewise.
+
 2015-03-27  Tobias Burnus  <burnus@net-b.de>
 
        PR c/65586
diff --git a/gcc/testsuite/g++.dg/template/friend58.C b/gcc/testsuite/g++.dg/template/friend58.C
new file mode 100644 (file)
index 0000000..cadfb3e
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/42328
+
+template<typename T, typename U>
+class freeList
+{
+public:
+  void foo() {};
+};
+
+class bar {};
+
+class baz : protected freeList<bar, baz>
+{
+  template<typename T>
+  friend
+  void freeList<T, baz>::foo();  // { dg-error "friend" }
+};
+
+baz b;
diff --git a/gcc/testsuite/g++.dg/template/friend59.C b/gcc/testsuite/g++.dg/template/friend59.C
new file mode 100644 (file)
index 0000000..e7c6d58
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/42328
+
+template<typename T, typename U>
+class freeList
+{
+public:
+  void foo() {};
+};
+
+class bar {};
+
+class baz;
+template<typename T> class freeList<T, baz> { void foo(); };
+
+class baz : protected freeList<bar, baz>
+{
+  template<typename T>
+  friend
+  void freeList<T, baz>::foo();
+};
+
+baz b;