]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++, coroutines: Make sure our temporaries are in a bind expr [PR105287]
authorIain Sandoe <iain@sandoe.co.uk>
Sun, 17 Apr 2022 19:58:28 +0000 (20:58 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 28 Apr 2022 12:51:44 +0000 (13:51 +0100)
commit15a176a833f23e64ad38690a678bf938227ce46f
tree837b6b0e44a19471835a43413837cb00fb0d98f3
parent9cb1f565a91e2dd57098c43593954b57c065a19b
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 <iain@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.
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/pr105287.C [new file with mode: 0644]