From: Paolo Carlini Date: Thu, 4 Apr 2019 15:38:05 +0000 (+0000) Subject: re PR c++/61327 (Problem with friend template object) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7f70a0925d510d2579f6c20bf056e30664ef0f6;p=gcc.git re PR c++/61327 (Problem with friend template object) 2019-04-04 Paolo Carlini PR c++/61327 * g++.dg/cpp0x/friend4.C: New. * g++.dg/cpp0x/friend5.C: Likewise. From-SVN: r270145 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1195c4339eb..0363d1f0d89 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-04 Paolo Carlini + + PR c++/61327 + * g++.dg/cpp0x/friend4.C: New. + * g++.dg/cpp0x/friend5.C: Likewise. + 2019-04-04 Paolo Carlini PR c++/56643 diff --git a/gcc/testsuite/g++.dg/cpp0x/friend4.C b/gcc/testsuite/g++.dg/cpp0x/friend4.C new file mode 100644 index 00000000000..6ff53dedef0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/friend4.C @@ -0,0 +1,30 @@ +// PR c++/61327 +// { dg-do compile { target c++11 } } + +template +struct A; + +template +struct A +{ + template + void f(U* u) { + u->T::g(); + } +}; + +struct B { +protected: + void g() { } +}; + +struct C : B { + template friend struct A; +}; + +int main() +{ + C c; + A a; + a.f(&c); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/friend5.C b/gcc/testsuite/g++.dg/cpp0x/friend5.C new file mode 100644 index 00000000000..39ea28b3ae1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/friend5.C @@ -0,0 +1,26 @@ +// PR c++/61327 +// { dg-do compile { target c++11 } } + +class B { +protected: + void f() {} +}; + +template +struct S; + +template +struct S{ + template + static void caller(T *p) {p->B::f();} +}; + +class Q : B{ +template friend struct S; +}; + +int main(){ + Q q; + S::caller(&q); + return 0; +}