[llvm-bugs] [Bug 46256] New: [coroutines] coroutines with potentially-throwing 'co_await promise.final_suspend()' expressions should be ill-formed
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 9 11:54:41 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46256
Bug ID: 46256
Summary: [coroutines] coroutines with potentially-throwing
'co_await promise.final_suspend()' expressions should
be ill-formed
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: lewissbaker at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
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
I believe this means that the compiler should reject with a diagnostic any
coroutine with a promise_type where `co_await promise.final_suspend()` is not
noexcept. 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
Clang (and GCC) currently accepts code that that does not declare
final_suspend() as
noexcept.
e.g. see https://godbolt.org/z/Et_5eo
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200609/503eb1ec/attachment-0001.html>
More information about the llvm-bugs
mailing list