@@ -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)
new file mode 100644
@@ -0,0 +1,9 @@
+// PR c++/96636
+// { dg-options "" }
+
+typedef class {
+ class a {};
+ class : virtual a {}; // { dg-error "anonymous struct with base" }
+} b;
+void foo(){ b();}
+