public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-69] c++: Add testcase for already fixed PR [PR16617]
@ 2021-04-22 17:41 Patrick Palka
0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2021-04-22 17:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:330cc29c06306ebf7bd3b2d37704cc69944923ff
commit r12-69-g330cc29c06306ebf7bd3b2d37704cc69944923ff
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Apr 22 13:32:40 2021 -0400
c++: Add testcase for already fixed PR [PR16617]
We correctly diagnose the invalid access since r11-1350.
gcc/testsuite/ChangeLog:
PR c++/16617
* g++.dg/template/access36.C: New test.
Diff:
---
gcc/testsuite/g++.dg/template/access36.C | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
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>();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-22 17:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 17:41 [gcc r12-69] c++: Add testcase for already fixed PR [PR16617] Patrick Palka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).