aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2020-02-21 10:45:56 -0700
committerMartin Sebor <msebor@redhat.com>2020-02-21 10:45:56 -0700
commitdbfba41e95d1d93b17e907b7f516b52ed3a3c415 (patch)
tree93af137ea1444ac1f140c538a9ed78a673edc692 /gcc/cp/class.c
parent9e58988061f4175896de11af0caf9bdd48c9b046 (diff)
downloadgcc-dbfba41e95d1d93b17e907b7f516b52ed3a3c415.zip
gcc-dbfba41e95d1d93b17e907b7f516b52ed3a3c415.tar.gz
gcc-dbfba41e95d1d93b17e907b7f516b52ed3a3c415.tar.bz2
PR c++/93753 - ICE on a flexible array followed by a member in an anonymous struct with an initializer
gcc/cp/ChangeLog: PR gcov-profile/93753 * class.c (check_flexarrays): Tighten up a test for potential members of anonymous structs or unions. gcc/testsuite/ChangeLog: PR gcov-profile/93753 * g++.dg/ext/flexary36.C: New test. * g++.dg/lto/pr93166_0.C: Make struct with flexarray valid.
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index a1fd1aa..772134d 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -7142,6 +7142,8 @@ check_flexarrays (tree t, flexmems_t *fmem /* = NULL */,
/* Is the type unnamed (and therefore a member of it potentially
an anonymous struct or union)? */
bool maybe_anon_p = TYPE_UNNAMED_P (t);
+ if (tree ctx = maybe_anon_p ? TYPE_CONTEXT (t) : NULL_TREE)
+ maybe_anon_p = RECORD_OR_UNION_TYPE_P (ctx);
/* Search the members of the current (possibly derived) class, skipping
unnamed structs and unions since those could be anonymous. */