On 2/3/20 12:55 AM, bin.cheng wrote:
Hi,
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 generating following code:
co_await promise.initial_suspend();
try {
// The original coroutine body
promise.return_void(); // The default return_void call.
} catch (...) {
promise.unhandled_exception();
}
final_suspend:
// ...
Bootstrap and test on x86_64. Is it OK?
Thanks,
bin
gcc/cp
2020-02-03 Bin Cheng <bin.ch...@linux.alibaba.com>
* 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
2020-02-03 Bin Cheng <bin.ch...@linux.alibaba.com>
* g++.dg/coroutines/torture/co-ret-15-default-return_void.C: New.
ok, thanks!
nathan
--
Nathan Sidwell