From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EAB4A3840C24; Tue, 9 Jun 2020 18:51:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAB4A3840C24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591728667; bh=0XkAI2O9JtcUyfcFp5ZS3fHs/XtW7vn9Q0SbNcOHmH8=; h=From:To:Subject:Date:From; b=aZgnb132gi1ff6YZJd8RNpqkeTFqa0h7Z+owfvIbn0/LYsUCuh9uP2FCPZDVVbMfl r8N8DKmOki3hCyPFflvyXY9rrs1VAstsnqNWtxD6FbY/WR6Od4vuLNB+Q8631JAHF+ 33Q7kFa7FLDkVmc6qdHJr4ZBo8Q/ONDUzBhgu5Cs= From: "lewissbaker.opensource at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95616] New: [coroutines] coroutines with potentially-throwing 'co_await promise.final_suspend()' expressions should be ill-formed Date: Tue, 09 Jun 2020 18:51:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lewissbaker.opensource at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2020 18:51:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95616 Bug ID: 95616 Summary: [coroutines] coroutines with potentially-throwing 'co_await promise.final_suspend()' expressions should be ill-formed Product: gcc Version: 10.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lewissbaker.opensource at gmail dot com Target Milestone: --- The wording of [dcl.fct.def.coroutine]/15 states: > The expression co_=C2=ADawait promise.final_=C2=ADsuspend() 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 n= ot 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 GCC (and Clang) currently accepts code that that does not declare final_suspend() as noexcept. e.g. see https://godbolt.org/z/Et_5eo=