diff options
author | Bin Cheng <bin.cheng@linux.alibaba.com> | 2020-03-09 18:54:57 +0800 |
---|---|---|
committer | Bin Cheng <bin.cheng@linux.alibaba.com> | 2020-03-09 18:54:57 +0800 |
commit | 016d0f9e43c1d2bd8227751b5b20a309c94edc90 (patch) | |
tree | 865c048244c3f8f01427e8bd3afc581227a75513 /gcc/alias.c | |
parent | cb2c60206f4f2218f84ccde21663b00de068d8c7 (diff) | |
download | gcc-016d0f9e43c1d2bd8227751b5b20a309c94edc90.zip gcc-016d0f9e43c1d2bd8227751b5b20a309c94edc90.tar.gz gcc-016d0f9e43c1d2bd8227751b5b20a309c94edc90.tar.bz2 |
Insert default return_void at the end of coroutine body
Exception in coroutine is not correctly handled because the default
return_void call is now inserted before the finish suspend point,
rather than at the end of the original coroutine body. This patch
fixes the issue by expanding code as following:
co_await promise.initial_suspend();
try {
// The original coroutine body
promise.return_void(); // The default return_void call.
} catch (...) {
promise.unhandled_exception();
}
final_suspend:
// ...
gcc/cp/
* coroutines.cc (build_actor_fn): Factor out code inserting the
default return_void call to...
(morph_fn_to_coro): ...here, also hoist local var declarations.
gcc/testsuite/
* g++.dg/coroutines/torture/co-ret-15-default-return_void.C: New.
Diffstat (limited to 'gcc/alias.c')
0 files changed, 0 insertions, 0 deletions