From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 21999385DC1A; Sat, 16 Jan 2021 08:30:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21999385DC1A From: "m.krause@tu-harburg.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98704] New: coroutine_handle::done() == false after promise's unhandled_exception() has thrown Date: Sat, 16 Jan 2021 08:30:55 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: m.krause@tu-harburg.de 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 attachments.created 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: Sat, 16 Jan 2021 08:30:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98704 Bug ID: 98704 Summary: coroutine_handle::done() =3D=3D false after promise's unhandled_exception() has thrown Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: m.krause@tu-harburg.de Target Milestone: --- Created attachment 49981 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D49981&action=3Dedit Reproducer [dcl.fct.def.coroutine]/14 says: "If the evaluation of the expression promise.unhandled_exception() exits via an exception, the coroutine is considered suspended at the final suspend point". So, after this exception = has propagated to the caller, I expect that the coroutine_handle's done() funct= ion returns true (because of [coroutine.handle.observers]/3 "Returns: true if t= he coroutine is suspended at its final suspend point, otherwise false"). However, the compiler for which I am reporting this makes done() return fal= se in this situation. See the attached example code (my expectation is 1 inste= ad of 0 in the final two lines of output). By the way, gcc 10.2, gcc trunk, clang 10.0.0, clang trunk, msvc 14.28 all behave in this way. See the short discussion on Slack Cpplang #coroutines starting on 02-Jan-2021. A fix for msvc is already underway: https://developercommunity.visualstudio.com/content/problem/1305540/corouti= ne-handledone-false-after-promises-unhandle.html=