Skip to content
Snippets Groups Projects
Commit e0324e26 authored by Jason Merrill's avatar Jason Merrill
Browse files

c++: allocator temps in list of arrays [PR108773]

The optimization to reuse the same allocator temporary for all string
constructor calls was breaking on this testcase, because the temps were
already in the argument to build_vec_init, and replacing them with
references to one slot got confused with calls at multiple levels (for the
initializer_list backing array, and then again for the array member of the
std::array).  Fixed by reusing the whole TARGET_EXPR instead of pulling out
the slot; gimplification ensures that it's only initialized once.

I also moved the check for initializing a std:: class down into the tree
walk, and handle multiple temps within a single array element
initialization.

	PR c++/108773

gcc/cp/ChangeLog:

	* init.cc (find_allocator_temps_r): New.
	(combine_allocator_temps): Replace find_allocator_temp.
	(build_vec_init): Adjust.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/initlist-array18.C: New test.
	* g++.dg/cpp0x/initlist-array19.C: New test.
parent 4214bdb1
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment