public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-932] c++: ICE with using and enum [PR100659]
@ 2021-05-20 3:11 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-05-20 3:11 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:fe9a6614a16b5ea7f12141c50b6b7de984390ed8
commit r12-932-gfe9a6614a16b5ea7f12141c50b6b7de984390ed8
Author: Jason Merrill <jason@redhat.com>
Date: Wed May 19 16:40:24 2021 -0400
c++: ICE with using and enum [PR100659]
Here the code for 'using enum' is confused by the combination of a
using-decl and an enum that are not from 'using enum'; this CONST_DECL is
from the normal unscoped enum scoping.
PR c++/100659
gcc/cp/ChangeLog:
* cp-tree.h (CONST_DECL_USING_P): Check for null TREE_TYPE.
gcc/testsuite/ChangeLog:
* g++.dg/parse/access13.C: New test.
Diff:
---
gcc/cp/cp-tree.h | 1 +
gcc/testsuite/g++.dg/parse/access13.C | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 860ed795299..aa202715873 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3553,6 +3553,7 @@ struct GTY(()) lang_decl {
created by handle_using_decl. */
#define CONST_DECL_USING_P(NODE) \
(TREE_CODE (NODE) == CONST_DECL \
+ && TREE_TYPE (NODE) \
&& TREE_CODE (TREE_TYPE (NODE)) == ENUMERAL_TYPE \
&& DECL_CONTEXT (NODE) != TREE_TYPE (NODE))
diff --git a/gcc/testsuite/g++.dg/parse/access13.C b/gcc/testsuite/g++.dg/parse/access13.C
new file mode 100644
index 00000000000..41463c5dde5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/access13.C
@@ -0,0 +1,7 @@
+// PR c++/100659
+
+template <typename> struct A
+{
+ A::E::V; // { dg-warning "access decl" }
+ enum { V }; // { dg-error "conflicts with a previous decl" }
+};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-20 3:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 3:11 [gcc r12-932] c++: ICE with using and enum [PR100659] Jason Merrill
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).