PR c++/80135
PR c++/81922
* typeck2.c (digest_init_r): Change nested argument type from bool to
int. Use code instead of TREE_CODE (type) where possible. If
nested == 2, diagnose initialization of flexible array member with
STRING_CST. Pass nested to process_init_constructor. Formatting fix.
(digest_init, digest_init_flags): Adjust digest_init_r caller.
(massage_init_elt): Add nested argument. Pass 2 instead of 1 to
digest_init_r's nested argument if nested is non-zero.
(process_init_constructor_array): Add nested argument. If nested == 2,
diagnose initialization of flexible array member with non-empty
braced enclosed list. Pass nested to massage_init_elt.
(process_init_constructor_record, process_init_constructor_union): Add
nested argument, pass it to massage_init_elt.
(process_init_constructor): Add nested argument, pass it to
process_init_constructor_{array,record,union}.
* init.c (find_field_init): Renamed to ...
(find_flexarray_init): ... this. Return NULL_TREE if init is
error_mark_node. Don't look through nested CONSTRUCTORs.
(warn_placement_new_too_small): Adjust caller.
* g++.dg/warn/Wplacement-new-size-1.C (fBx1): Initialize nested
flexible array member only with {}. Add dg-warning.
(fBx2, fBx3): Remove.
* g++.dg/warn/Wplacement-new-size-2.C (fBx1): Initialize nested
flexible array member only with {}. Add dg-warning.
(fBx2, fBx3): Remove.
* g++.dg/warn/Wplacement-new-size-6.C: New test.
* g++.dg/ext/flexary13.C (main): Remove test for initialization
of nested flexible array member with non-empty initializer.
* g++.dg/ext/flexary25.C: New test.
* g++.dg/ext/flexary26.C: New test.
* g++.dg/ext/flexary27.C: New test.
* g++.dg/parse/pr43765.C: Expect diagnostics about initialization
of nested flexible array member with non-empty initializer. Expect
C++2A diagnostics about mixing of designated and non-designated
initializers.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255703 138bc75d-0d04-0410-961f-82ee72b054a4
12 files changed: