]> gcc.gnu.org Git - gcc.git/commit
coroutines: Implement n4849 changes to exception handling.
authorIain Sandoe <iain@sandoe.co.uk>
Thu, 26 Mar 2020 20:17:13 +0000 (20:17 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 26 Mar 2020 20:31:05 +0000 (20:31 +0000)
commit2a1f0f64160e078e23795901ff98575805d6875b
treed2ed2c50dfb587d54af0b82d5e77399ab986d6b0
parent16948c54b7576fb4b27c59915eac71a0c6bf94f6
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.
gcc/cp/ChangeLog
gcc/cp/coroutines.cc
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/coroutines/torture/exceptions-test-01-n4849-a.C [new file with mode: 0644]
This page took 0.059529 seconds and 5 git commands to generate.