[Bug c++/98704] coroutine_handle::done() == false after promise's unhandled_exception() has thrown

m.krause@tu-harburg.de gcc-bugzilla@gcc.gnu.org
Sun Jan 17 13:29:21 GMT 2021


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

--- Comment #1 from Michael Krause <m.krause@tu-harburg.de> ---
Created attachment 49985
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49985&action=edit
A possible fix?

Would this be the proper way to fix the problem? That is, instead of generating
a simple "promise.unhandled_exception()" call, generate:

         try {
             promise.unhandled_exception();
         } catch(...) {
             resume_fn_ptr = 0; // ensure that done() returns true
             throw;
         }

Seems to fix my problem, but then I don't know the gcc code base; maybe the
change has undesired side effects. If somebody can confirm this is the way to
go, I would be willing to provide a cleaned-up, mergable version including test
cases etc...


More information about the Gcc-bugs mailing list