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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

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

commit r12-9159-gc153fb6a5bda225fcfb34e17994a31b65616a6db
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Jan 24 11:28:00 2023 +0100

    c++: Handle structured bindings like anon unions in initializers [PR108474]

    As reported by Andrew Pinski, structured bindings (with the exception
    of the ones using std::tuple_{size,element} and get which are really
    standalone variables in addition to the binding one) also use
    DECL_VALUE_EXPR and needs the same treatment in static initializers.

    On Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote:
    > Though, actually, why not instead fix expand_expr_real_1 (and staticp) to
    > look through DECL_VALUE_EXPR?

    Doing it when emitting the initializers seems to be too late to me,
    we in various spots try to put parts of the static var DECL_INITIAL
expressions
    into the IL, or e.g. for varpool purposes remember which vars are
referenced
    there.

    This patch moves it to record_reference, which is called from
varpool_node::analyze
    and so about the same time as gimplification of the bodies which also
    replaces DECL_VALUE_EXPRs.

    2023-01-24  Jakub Jelinek  <ja...@redhat.com>

            PR c++/108474
            * cp-gimplify.cc (cp_fold_r): Handle structured bindings
            vars like anon union artificial vars.

            * g++.dg/cpp1z/decomp57.C: New test.
            * g++.dg/cpp1z/decomp58.C: New test.

    (cherry picked from commit b84e21115700523b4d0ac44275443f7b9c670344)

Reply via email to