From: Nathan Sidwell <nathan@acm.org>
To: Iain Sandoe <iain@sandoe.co.uk>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] coroutines : Do not accept throwing final await expressions [PR95616].
Date: Thu, 4 Mar 2021 15:05:43 -0500 [thread overview]
Message-ID: <c8005024-21ef-1c8a-3c03-80d928028bb4@acm.org> (raw)
In-Reply-To: <A02ED582-4D85-4C2D-ABC8-08EFB788D191@sandoe.co.uk>
On 3/4/21 2:54 PM, Iain Sandoe wrote:
> Hi,
>
> 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.
>
> [ accepts invalid ]
> tested on x86_64-darwin, x86_64-linux-gnu,
> OK for master / 10.x?
> thanks
> Iain
>
>
> 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.
>
ok. Does this DTRT in the presence of -fno-exceptions? (i.e. use of
that flag means you don't have to decorate everything with noexcept)
nathan
--
Nathan Sidwell
next prev parent reply other threads:[~2021-03-04 20:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 19:54 Iain Sandoe
2021-03-04 20:05 ` Nathan Sidwell [this message]
2021-03-05 17:03 ` Iain Sandoe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c8005024-21ef-1c8a-3c03-80d928028bb4@acm.org \
--to=nathan@acm.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=iain@sandoe.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).