2019-04-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61327
* g++.dg/cpp0x/friend4.C: New.
* g++.dg/cpp0x/friend5.C: Likewise.
From-SVN: r270145
+2019-04-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/61327
+ * g++.dg/cpp0x/friend4.C: New.
+ * g++.dg/cpp0x/friend5.C: Likewise.
+
2019-04-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56643
--- /dev/null
+// PR c++/61327
+// { dg-do compile { target c++11 } }
+
+template<typename... T>
+struct A;
+
+template<typename T>
+struct A<T>
+{
+ template<typename U>
+ void f(U* u) {
+ u->T::g();
+ }
+};
+
+struct B {
+protected:
+ void g() { }
+};
+
+struct C : B {
+ template<typename...> friend struct A;
+};
+
+int main()
+{
+ C c;
+ A<B> a;
+ a.f(&c);
+}
--- /dev/null
+// PR c++/61327
+// { dg-do compile { target c++11 } }
+
+class B {
+protected:
+ void f() {}
+};
+
+template <typename...>
+struct S;
+
+template <typename R>
+struct S<R>{
+ template <typename T>
+ static void caller(T *p) {p->B::f();}
+};
+
+class Q : B{
+template <typename...> friend struct S;
+};
+
+int main(){
+ Q q;
+ S<int>::caller(&q);
+ return 0;
+}