Title
Incomplete definition of resumer
Status
ready
Section
9.5.4 [dcl.fct.def.coroutine]
Submitter
Jim X

Created on 2022-02-15.00:00:00 last changed 1 month ago

Messages

Date: 2022-08-26.21:45:07

Proposed resolution (approved by CWG 2022-08-26):

Change in 9.5.4 [dcl.fct.def.coroutine] paragraph 8 as follows:

A suspended coroutine can be resumed to continue execution by invoking a resumption member function (17.13.4.6 [coroutine.handle.resumption]) of a coroutine handle (17.13.4 [coroutine.handle]) that refers to the coroutine. The function evaluation that invoked a resumption member function is called the resumer.
Date: 2022-08-26.21:45:07

Subclause 9.5.4 [dcl.fct.def.coroutine] paragraph 8 specifies:

A suspended coroutine can be resumed to continue execution by invoking a resumption member function (17.13.4.6 [coroutine.handle.resumption]) of a coroutine handle (17.13.4 [coroutine.handle]) that refers to the coroutine. The function that invoked a resumption member function is called the resumer.

However, non-functions can also resume a coroutine, for example:

Task task() {
  std::cout << "in task\n";
  int r = co_await Line();
  std::cout << "resumed\n";
  co_return r;
}
auto r = task();
auto c = (r.coro_.resume(), 0); // #1
History
Date User Action Args
2022-08-26 21:45:07adminsetmessages: + msg6909
2022-08-26 21:45:07adminsetstatus: open -> ready
2022-02-15 00:00:00admincreate