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

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

https://gcc.gnu.org/g:749221fac55059a145d3fdaf416fe663a4ee33d9

commit r14-11535-g749221fac55059a145d3fdaf416fe663a4ee33d9
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon Apr 7 11:49:19 2025 -0400

    c++: constinit and value-initialization [PR119652]

    Value-initialization built an AGGR_INIT_EXPR to set AGGR_INIT_ZERO_FIRST
on.
    Passing that AGGR_INIT_EXPR to maybe_constant_value returned a TARGET_EXPR,
    which potential_constant_expression_1 mistook for a temporary.

    We shouldn't add a TARGET_EXPR to the AGGR_INIT_EXPR in this case, just
like
    we already avoid adding it to CONSTRUCTOR or CALL_EXPR.

            PR c++/119652

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_eval_outermost_constant_expr): Also don't add a
            TARGET_EXPR around AGGR_INIT_EXPR.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/constinit20.C: New test.

    (cherry picked from commit c7dc9b6f889fa8f9e4ef060c3af107eaf54265c5)

Reply via email to