https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108773

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:e0324e2629e25a90c13c68b4eef1e47b091970c3

commit r13-6566-ge0324e2629e25a90c13c68b4eef1e47b091970c3
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon Mar 6 22:57:57 2023 -0500

    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.

Reply via email to