aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-02-15 17:11:31 +0000
committerIain Sandoe <iain@sandoe.co.uk>2021-03-05 16:56:19 +0000
commit9ee91079fd5879cba046e452ab5593372166b2ab (patch)
tree85fa95e658d91ee2e9f40e1953bceabf37d55039 /gcc/tree-cfg.c
parentfe55086547c9360b530e040a6673dae10ac77847 (diff)
downloadgcc-9ee91079fd5879cba046e452ab5593372166b2ab.zip
gcc-9ee91079fd5879cba046e452ab5593372166b2ab.tar.gz
gcc-9ee91079fd5879cba046e452ab5593372166b2ab.tar.bz2
coroutines : Do not accept throwing final await expressions [PR95616].
From the PR: The wording of [dcl.fct.def.coroutine]/15 states: * The expression co_await promise.final_suspend() shall not be potentially-throwing ([except.spec]). See http://eel.is/c++draft/dcl.fct.def.coroutine#15 and http://eel.is/c++draft/except.spec#6 ie. all of the following must be declared noexcept (if they form part of the await-expression): - promise_type::final_suspend() - finalSuspendObj.operator co_await() - finalSuspendAwaiter.await_ready() - finalSuspendAwaiter.await_suspend() - finalSuspendAwaiter.await_resume() - finalSuspedObj destructor - finalSuspendAwaiter destructor This implements the checks for these cases and rejects such code with a diagnostic if exceptions are enabled. gcc/cp/ChangeLog: PR c++/95616 * coroutines.cc (coro_diagnose_throwing_fn): New helper. (coro_diagnose_throwing_final_aw_expr): New helper. (build_co_await): Diagnose throwing final await expression components. (build_init_or_final_await): Diagnose a throwing promise final_suspend() call. gcc/testsuite/ChangeLog: PR c++/95616 * g++.dg/coroutines/pr95616-0-no-exceptions.C: New test. * g++.dg/coroutines/pr95616-0.C: New test. * g++.dg/coroutines/pr95616-1-no-exceptions.C: New test. * g++.dg/coroutines/pr95616-1.C: New test. * g++.dg/coroutines/pr95616-2.C: New test. * g++.dg/coroutines/pr95616-3-no-exceptions.C: New test. * g++.dg/coroutines/pr95616-3.C: New test. * g++.dg/coroutines/pr95616-4.C: New test. * g++.dg/coroutines/pr95616-5.C: New test. * g++.dg/coroutines/pr95616-6.C: New test.
Diffstat (limited to 'gcc/tree-cfg.c')
0 files changed, 0 insertions, 0 deletions