diff options
author | Jason Merrill <jason@redhat.com> | 2022-12-06 09:51:51 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-12-08 13:40:21 -0500 |
commit | d081807d8d70e3e87eae41e1560e54d503f4d465 (patch) | |
tree | 185855bcdb475ae4a4034cbb4441d20d661fa927 /gcc/fortran/trans-openmp.cc | |
parent | 1e1847612d7f169f82c985b0b3a5e3301d6fe999 (diff) | |
download | gcc-d081807d8d70e3e87eae41e1560e54d503f4d465.zip gcc-d081807d8d70e3e87eae41e1560e54d503f4d465.tar.gz gcc-d081807d8d70e3e87eae41e1560e54d503f4d465.tar.bz2 |
c++: avoid initializer_list<string> [PR105838]
When constructing a vector<string> from { "strings" }, first is built an
initializer_list<string>, which is then copied into the strings in the
vector. But this is inefficient: better would be treat the { "strings" }
as a range and construct the strings in the vector directly from the
string-literals. We can do this transformation for standard library
classes because we know the design patterns they follow.
PR c++/105838
gcc/cp/ChangeLog:
* call.cc (list_ctor_element_type): New.
(braced_init_element_type): New.
(has_non_trivial_temporaries): New.
(maybe_init_list_as_array): New.
(maybe_init_list_as_range): New.
(build_user_type_conversion_1): Use maybe_init_list_as_range.
* parser.cc (cp_parser_braced_list): Call
recompute_constructor_flags.
* cp-tree.h (find_temps_r): Declare.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/initlist-opt1.C: New test.
Diffstat (limited to 'gcc/fortran/trans-openmp.cc')
0 files changed, 0 insertions, 0 deletions