diff options
author | Jason Merrill <jason@redhat.com> | 2021-07-30 16:49:03 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-07-31 10:43:42 -0400 |
commit | af76342b444948ab262b276cdf083c2d2e0cebbb (patch) | |
tree | 105ad963bd8472d3a17803ef488b4d76733ac624 /gcc/cp/decl.c | |
parent | 5b759cdcb7f863520346e5bf63fcf1d3746c2cc3 (diff) | |
download | gcc-af76342b444948ab262b276cdf083c2d2e0cebbb.zip gcc-af76342b444948ab262b276cdf083c2d2e0cebbb.tar.gz gcc-af76342b444948ab262b276cdf083c2d2e0cebbb.tar.bz2 |
c++: ICE on anon struct with base [PR96636]
pinski pointed out that my recent change to reject anonymous structs with
bases was relevant to this PR. But we still ICEd after giving that error;
this fixes the ICE.
PR c++/96636
gcc/cp/ChangeLog:
* decl.c (fixup_anonymous_aggr): Clear TYPE_NEEDS_CONSTRUCTING
after error.
gcc/testsuite/ChangeLog:
* g++.dg/ext/anon-struct9.C: New test.
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e4be6be..6fa6b9a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5094,7 +5094,11 @@ fixup_anonymous_aggr (tree t) tree field, type; if (BINFO_N_BASE_BINFOS (TYPE_BINFO (t))) - error_at (location_of (t), "anonymous struct with base classes"); + { + error_at (location_of (t), "anonymous struct with base classes"); + /* Avoid ICE after error on anon-struct9.C. */ + TYPE_NEEDS_CONSTRUCTING (t) = false; + } for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field)) if (TREE_CODE (field) == FIELD_DECL) |