c++: designator and anon struct [PR101767]
commite3e191b4104c7d6a177f66dbb77cabf05ab63781
authorJason Merrill <jason@redhat.com>
Fri, 18 Mar 2022 18:36:19 +0000 (18 14:36 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 21 Mar 2022 20:46:31 +0000 (21 16:46 -0400)
treee68af1e50db30c91671c5585ac5e8d59f09b2904
parent3873e614ef295b9fc8b3a1fc536d29d0c3fe37c0
c++: designator and anon struct [PR101767]

We found .x in the anonymous struct, but then didn't find .y there; we
should decide that means we're done with the struct rather than that the
code is wrong.

PR c++/101767

gcc/cp/ChangeLog:

* decl.cc (reshape_init_class): Back out of anon struct
if a designator doesn't match.

gcc/testsuite/ChangeLog:

* g++.dg/ext/anon-struct10.C: New test.
gcc/cp/decl.cc
gcc/testsuite/g++.dg/ext/anon-struct10.C [new file with mode: 0644]