aboutsummaryrefslogtreecommitdiff
path: root/gcc/config.gcc
diff options
context:
space:
mode:
authorWill Wray <wjwray@gmail.com>2022-01-14 19:28:53 -0500
committerJason Merrill <jason@redhat.com>2022-01-23 17:27:06 -0500
commit2da90ad39bf8fa9ee287e040d1f4411cb7a2e7ed (patch)
tree8fe11cd45aa5875095a1ddc94a86e8df6c4dd5c6 /gcc/config.gcc
parentcbcf4a50fa21abd7a4a50a7ce47ada80b115febc (diff)
downloadgcc-2da90ad39bf8fa9ee287e040d1f4411cb7a2e7ed.zip
gcc-2da90ad39bf8fa9ee287e040d1f4411cb7a2e7ed.tar.gz
gcc-2da90ad39bf8fa9ee287e040d1f4411cb7a2e7ed.tar.bz2
c++: designated init of char array by string constant [PR55227]
There are two underlying bugs in the designated initialization of char array fields by string literals that cause: (1) Rejection of valid cases with: (a) brace-enclosed string literal initializer (of any valid size), or (b) unbraced string literal shorter than the target char array field. (2) Acceptance of invalid cases with designators appearing within the braces of a braced string literal, in which case the bogus 'designator' was being entirely ignored and the string literal treated as a positional initializer. The fixes above allow to address a FIXME in cp_complete_array_type: /* FIXME: this code is duplicated from reshape_init. Probably we should just call reshape_init here? */ I believe that this was obstructed by the designator bugs (see comment here https://patchwork.ozlabs.org/project/gcc/list/?series=199783) PR c++/55227 gcc/cp/ChangeLog: * decl.cc (reshape_init_r): Only call has_designator_check when first_initializer_p or for the inner constructor element. (cp_complete_array_type): Call reshape_init on braced-init-list. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/desig21.C: New test.
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions