coroutines-ts icon indicating copy to clipboard operation
coroutines-ts copied to clipboard

Behaviour of an `unhandled_exception()` method that throws an exception is under-specified

Open lewissbaker opened this issue 6 years ago • 5 comments

If a coroutine's promise object throws an exception from promise_type::unhandled_exception() (eg. if it rethrows the current exception), what state is the coroutine left in?

Is the coroutine suspended prior to the exception propagating out of the initial-call/resume-call?

Is the coroutine frame safe to destroy by the caller or is it already destroyed?

Is the promise object destroyed? The pseudo-code would imply that it is.

Is the coroutine done()? The definition of done() implies that it's only true if suspended at final_suspend() but control flow of the psuedo-code in [N4663] implies that final_suspend() would be skipped in this case.

Wording of [N4663] section 8.4.4(3) doesn't seem to clearly define semantics of this case.

lewissbaker avatar Jul 19 '17 05:07 lewissbaker