* typeck2.c (process_init_constructor_record): Use
init_list_type_node for the CONSTRUCTOR around an anonymous union
designated initializer.
From-SVN: r258982
+2018-03-30 Jason Merrill <jason@redhat.com>
+
+ * typeck2.c (process_init_constructor_record): Use
+ init_list_type_node for the CONSTRUCTOR around an anonymous union
+ designated initializer.
+
2018-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/84791
designated-initializer-list { D }, where D is the
designated-initializer-clause naming a member of the
anonymous union object. */
- next = build_constructor_single (type, ce->index, ce->value);
+ next = build_constructor_single (init_list_type_node,
+ ce->index, ce->value);
else
{
ce = NULL;
--- /dev/null
+// { dg-do compile }
+// { dg-options "" }
+
+struct A {
+ union {
+ int a;
+ char b;
+ };
+};
+
+struct A x = {
+ .a = 5,
+};