[llvm-bugs] [Bug 48770] New: coroutine_handle::done() == false after promise's unhandled_exception() has thrown

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 16 00:19:43 PST 2021


            Bug ID: 48770
           Summary: coroutine_handle::done() == false after promise's
                    unhandled_exception() has thrown
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: m.krause at tu-harburg.de
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 24386
  --> https://bugs.llvm.org/attachment.cgi?id=24386&action=edit

[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. A fix for msvc
is already underway:

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/20210116/a5c4916e/attachment.html>

More information about the llvm-bugs mailing list