]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++, coroutines: Ensure that the resumer is marked as can_throw.
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 7 Jun 2025 16:01:15 +0000 (17:01 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 29 Jul 2025 15:07:22 +0000 (16:07 +0100)
commit956b6c30219b56381cb0b3765859c60545327707
treefd38696488134556c620f624ba150055e7475e48
parente25730c90a7bd90cb541b848d3c378d5fc713ef9
c++, coroutines: Ensure that the resumer is marked as can_throw.

We must flag that the resumer might throw (since the wrapping of the
original function body unconditionally adds a try-catch/rethrow). We
also add code that might throw - even when the original function body
would not.

TODO: We could improve code-gen by recognising cases where the combined
body + initial await expressions cannot throw and omitting the unneeded
try/catch/rethrow wrapper.

gcc/cp/ChangeLog:

* coroutines.cc (build_actor_fn): Set can_throw.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
(cherry picked from commit e83c4bfc338fad0c87b2debb37ccfe98d148c7ac)
gcc/cp/coroutines.cc