https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120684
--- Comment #2 from GCC 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:53c832282690ca1cd86e2eaf0128c70ba4edfc0f commit r16-1916-g53c832282690ca1cd86e2eaf0128c70ba4edfc0f 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.