re PR c++/87571 (ICE in friend_accessible_p, accessing protected member of template...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 11 Mar 2019 10:30:24 +0000 (10:30 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 11 Mar 2019 10:30:24 +0000 (10:30 +0000)
2019-03-11  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/87571
* g++.dg/template/memfriend18.C: New.

From-SVN: r269575

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

index fc117d8f5a36b0472fe6e21d3733025e1f1b2820..ac02d28b85752afcd08692f373b786e5e791e8c8 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-11  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/87571
+       * g++.dg/template/memfriend18.C: New.
+
 2019-03-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * gdc.dg/pr89041.d: Mark as compile test.
diff --git a/gcc/testsuite/g++.dg/template/memfriend18.C b/gcc/testsuite/g++.dg/template/memfriend18.C
new file mode 100644 (file)
index 0000000..ac21896
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/87571
+
+template <class> struct A {
+  template <class> struct B {
+    template <class> friend class B;
+  protected:
+    int protected_member_;
+  public:
+    template <class T> int method(const B<T>& other) const {
+      return other.protected_member_;
+    }
+  };
+};
+
+int main() {
+  A<int>::B<int> a;
+  A<int>::B<char> b;
+  a.method(b);
+}