coroutines: Implement n4849 changes to exception handling.
The standard now calls up a revised mechanism to handle exceptions
where exceptions thrown by the await_resume () method of the
initial suspend expression are considered in the same manner as
exceptions thrown by the user-authored function body.
This implements [dcl.fct.def.coroutine] / 5.3.
gcc/cp/ChangeLog:
2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
* coroutines.cc (co_await_expander): If we are expanding the
initial await expression, set a boolean flag to show that we
have now reached the initial await_resume() method call.
(expand_co_awaits): Handle the 'initial await resume called' flag.
(build_actor_fn): Insert the initial await expression into the
start of the user-authored function-body. Handle the 'initial await
resume called' flag.
(morph_fn_to_coro): Initialise the 'initial await resume called'
flag. Modify the unhandled exception catch clause to recognise
exceptions that occur before the initial await_resume() and re-
throw them.
gcc/testsuite/ChangeLog:
2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
* g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C: New test.