diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/desig9.C | 13 |
3 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 13b2435..3ea9faa 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 464e8a7..3aae0a3 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -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; diff --git a/gcc/testsuite/g++.dg/cpp2a/desig9.C b/gcc/testsuite/g++.dg/cpp2a/desig9.C new file mode 100644 index 0000000..990a2aa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/desig9.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "" } + +struct A { + union { + int a; + char b; + }; +}; + +struct A x = { + .a = 5, +}; |