<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - coroutine_handle::done() == false after promise's unhandled_exception() has thrown"
   href="https://bugs.llvm.org/show_bug.cgi?id=48770">48770</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>coroutine_handle::done() == false after promise's unhandled_exception() has thrown
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>m.krause@tu-harburg.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24386" name="attach_24386" title="Reproducer">attachment 24386</a> <a href="attachment.cgi?id=24386&action=edit" title="Reproducer">[details]</a></span>
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. A fix for msvc
is already underway:
<a href="https://developercommunity.visualstudio.com/content/problem/1305540/coroutine-handledone-false-after-promises-unhandle.html">https://developercommunity.visualstudio.com/content/problem/1305540/coroutine-handledone-false-after-promises-unhandle.html</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>