Hi, By standard, coroutine body should be encapsulated in try-catch block as following: try { // coroutine body } catch(...) { promise.unhandled_exception(); } Given above try-catch block is implemented in the coroutine actor function called by coroutine ramp function, so the promise should be accessed via actor function's coroutine frame pointer argument, rather than the ramp function's coroutine frame variable.
This patch also refactored code to make the fix easy, unfortunately, I failed to reduce a test case from cpproro. Bootstrap and test ongoing. Is it OK? Thanks, bin gcc/cp 2020-01-20 Bin Cheng <bin.li...@linux.alibaba.com> * coroutines.cc (act_des_fn, wrap_coroutine_body): New. (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls, as well as access promise via actor function's frame pointer argument. Refactor code into above functions. (build_actor_fn, build_destroy_fn): Use frame pointer argument.
0001-Use-promise-in-coroutine-frame-in-actor-function.patch
Description: Binary data