https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105287
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>: https://gcc.gnu.org/g:15a176a833f23e64ad38690a678bf938227ce46f commit r12-8308-g15a176a833f23e64ad38690a678bf938227ce46f Author: Iain Sandoe <i...@sandoe.co.uk> Date: Sun Apr 17 20:58:28 2022 +0100 c++, coroutines: Make sure our temporaries are in a bind expr [PR105287] There are a few cases where we can generate a temporary that does not need to be added to the coroutine frame (i.e. these are genuinely ephemeral). The intent was that unnamed temporaries should not be 'promoted' to coroutine frame entries. However there was a thinko and these were not actually ever added to the bind expressions being generated for the expanded awaits. This meant that they were showing in the global namspace, leading to an empty DECL_CONTEXT and the ICE reported. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk> PR c++/105287 gcc/cp/ChangeLog: * coroutines.cc (maybe_promote_temps): Ensure generated temporaries are added to the bind expr. (add_var_to_bind): Fix local var naming to use portable punctuation. (register_local_var_uses): Do not add synthetic names to unnamed temporaries. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr105287.C: New test.