@@ -1627,6 +1627,13 @@ process_init_constructor_record (tree type, tree init, int nested, int flags,
}
}
+ if (DECL_SIZE (field) && integer_zerop (DECL_SIZE (field))
+ && !TREE_SIDE_EFFECTS (next))
+ /* Don't add trivial initialization of an empty base/field to the
+ constructor, as they might not be ordered the way the back-end
+ expects. */
+ continue;
+
/* If this is a bitfield, now convert to the lowered type. */
if (type != TREE_TYPE (field))
next = cp_convert_and_check (TREE_TYPE (field), next, complain);
new file mode 100644
@@ -0,0 +1,8 @@
+// PR c++/88690
+// { dg-do compile { target c++11 } }
+
+struct A { int a = 1; };
+struct B { int b = 0; };
+struct C { C() = default; C (const C&) = delete; };
+struct D : public B, public C {};
+struct E : A { D f; } g{};
@@ -1,3 +1,9 @@
+2019-02-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/88690 - C++17 ICE with empty base in aggregate.
+ * typeck2.c (process_init_constructor_record): Skip trivial
+ initialization of an empty base.
+
2019-02-21 Richard Biener <rguenther@suse.de>
PR middle-end/89392