https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118856
--- Comment #13 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:720c8f685210af9fc9c31810e224751102f1481e commit r15-7591-g720c8f685210af9fc9c31810e224751102f1481e Author: Jason Merrill <ja...@redhat.com> Date: Sun Feb 16 11:00:36 2025 +0100 c++: extended temps and statement-exprs [PR118763] My last patch for 118856 broke the test for 118763 (which my testing didn't catch, for some reason), because it effectively reverted Jakub's recent fix (r15-7415) for that bug. It seems we need a new flag to indicate internal temporaries. In that patch Jakub wondered if other uses of CLEANUP_EH_ONLY would have the same issue with jumps out of a statement-expr, and indeed it seems that maybe_push_temp_cleanup and now set_up_extended_ref_temp have the same problem. Since maybe_push_temp_cleanup already uses a flag, we can easily stop setting CLEANUP_EH_ONLY there as well. Since set_up_extended_ref_temp doesn't, working around this issue there will be more involved. PR c++/118856 PR c++/118763 gcc/cp/ChangeLog: * cp-tree.h (TARGET_EXPR_INTERNAL_P): New. * call.cc (extend_temps_r): Check it instead of CLEANUP_EH_ONLY. * tree.cc (get_internal_target_expr): Set it instead. * typeck2.cc (maybe_push_temp_cleanup): Don't set CLEANUP_EH_ONLY. gcc/testsuite/ChangeLog: * g++.dg/ext/stmtexpr29.C: New test.