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

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

https://gcc.gnu.org/g:6b19e40f982829c460439d270d34c5c848d90c6e

commit r15-9916-g6b19e40f982829c460439d270d34c5c848d90c6e
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Jul 2 18:03:57 2025 -0400

    c++: uninitialized TARGET_EXPR and constexpr [PR120684]

    In r15-7532 for PR118856 I introduced a TARGET_EXPR with a
    TARGET_EXPR_INITIAL of void_node to express that no initialization is done.
    And indeed evaluating that doesn't store a value for the TARGET_EXPR_SLOT
    variable.

    But then at the end of the full-expression, destroy_value stores void_node
    to express that its lifetime has ended.  If we evaluate the same
    full-expression again, global_ctx->values still holds the void_node,
causing
    confusion when we try to destroy it again.  So clear out any value before
    evaluating a TARGET_EXPR_INITIAL of void_type.

            PR c++/120684
            PR c++/118856

    gcc/cp/ChangeLog:

            * constexpr.cc (cxx_eval_constant_expression) [TARGET_EXPR]: Clear
            the value first if is_complex.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp23/range-for10.C: New test.

Reply via email to