Commit 6d92f131 by Jason Merrill Committed by Jason Merrill

Fix designated initializer for anonymous union.

	* typeck2.c (process_init_constructor_record): Use
	init_list_type_node for the CONSTRUCTOR around an anonymous union
	designated initializer.

From-SVN: r258982
parent 9d620422
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
......
......@@ -1435,7 +1435,8 @@ process_init_constructor_record (tree type, tree init, int nested,
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;
......
// { dg-do compile }
// { dg-options "" }
struct A {
union {
int a;
char b;
};
};
struct A x = {
.a = 5,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment