Message ID | 20210422174312.3233509-1-ppalka@redhat.com |
---|---|
State | New |
Headers | show |
Series | [committed] c++: Add testcase for already fixed PR [PR16617] | expand |
diff --git a/gcc/testsuite/g++.dg/template/access36.C b/gcc/testsuite/g++.dg/template/access36.C new file mode 100644 index 00000000000..72ca23c7017 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/access36.C @@ -0,0 +1,25 @@ +// PR c++/16617 + +class B +{ + protected: + int i; +}; + +template <class T> void fr (); + +class D2 : public B +{ + friend void fr<int> (); +}; + +template<int B::*> struct X +{}; + +template <class T> void fr () +{ + X<&B::i> x1; // { dg-error "protected" } + X<&D2::i> x2; // { dg-error "protected" } +} + +template void fr<char>();