https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124584
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:0eaa676f6e15fab1a566fe410d23aaf83e05c36f commit r16-9218-g0eaa676f6e15fab1a566fe410d23aaf83e05c36f Author: Jason Merrill <[email protected]> Date: Thu Jul 2 17:54:22 2026 -0400 c++: co_await and structured bindings [PR124584] Here the internal guard variables that control whether to clean up the structured binding variables were not living across the call to co_await because they weren't promoted into the coroutine frame. The underlying problem is using a TARGET_EXPR, which lives only for the full-expression, to hold a value that needs to live as long as the variable itself. So get_temp_regvar seems like a better fit. We also need to manually pushdecl the guard variable so that it's visible to register_local_var_uses. It might be better to use the wrap_temporary_cleanups mechanism for the main variable, as we do for normal variables. But let's go with the simple fix for now. PR c++/124584 gcc/cp/ChangeLog: * decl.cc (cp_finish_decl): Use get_temp_regvar for decomp guards. gcc/testsuite/ChangeLog: * g++.dg/coroutines/torture/tuple-decomp-pr124584.C: New test. (cherry picked from commit a085455306ec4aa15a11efacd994968bf951f7b6)
