-
- Downloads
c++: build initializer_list<string> in a loop [PR105838]
The previous patch avoided building an initializer_list<string> at all when building a vector<string>, but in situations where that isn't possible, we could still build the initializer_list with a loop over a constant array. This is represented using a VEC_INIT_EXPR, which required adjusting a couple of places that expected the initializer array to have the same type as the target array and fixing build_vec_init not to undo our efforts. PR c++/105838 gcc/cp/ChangeLog: * call.cc (convert_like_internal) [ck_list]: Use maybe_init_list_as_array. * constexpr.cc (cxx_eval_vec_init_1): Init might have a different type. * tree.cc (build_vec_init_elt): Likewise. * init.cc (build_vec_init): Handle from_array from a TARGET_EXPR. Retain TARGET_EXPR of a different type. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/initlist-opt2.C: New test.
Showing
- gcc/cp/call.cc 10 additions, 1 deletiongcc/cp/call.cc
- gcc/cp/constexpr.cc 3 additions, 3 deletionsgcc/cp/constexpr.cc
- gcc/cp/init.cc 11 additions, 2 deletionsgcc/cp/init.cc
- gcc/cp/tree.cc 0 additions, 2 deletionsgcc/cp/tree.cc
- gcc/testsuite/g++.dg/tree-ssa/initlist-opt2.C 24 additions, 0 deletionsgcc/testsuite/g++.dg/tree-ssa/initlist-opt2.C
Loading
Please register or sign in to comment