public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "m.krause@tu-harburg.de" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-98704-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98704

            Bug ID: 98704
           Summary: coroutine_handle::done() == 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=49981&action=edit
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() function
returns true (because of [coroutine.handle.observers]/3 "Returns: true if the
coroutine is suspended at its final suspend point, otherwise false").

However, the compiler for which I am reporting this makes done() return false
in this situation. See the attached example code (my expectation is 1 instead
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/coroutine-handledone-false-after-promises-unhandle.html

             reply	other threads:[~2021-01-16  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16  8:30 m.krause@tu-harburg.de [this message]
2021-01-17 13:29 ` [Bug c++/98704] " m.krause@tu-harburg.de
2021-03-12 15:28 ` iains at gcc dot gnu.org
2021-03-15 15:56 ` cvs-commit at gcc dot gnu.org
2021-03-22 22:04 ` cvs-commit at gcc dot gnu.org
2021-03-24 12:40 ` iains at gcc dot gnu.org

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=bug-98704-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).