Relative Content

Tag Archive for c++c++-coroutine

co_await — unexpected result in MSVC

I have a rather straightforward Event design, which defines a trigger() function and operator co_await() and keeps a set of awaitables, which it resumes when triggered. A demo is here.

Simple coroutine example, crashing each time

Below code generates SIGSEGV, can You explain what I am doing wrong here? If I call next() exactly 4 times, then all is ok, the problem is if I call it 5-th time. I suppose there is something wrong with the T next() { implementation. What I want is the exception to be thrown when the coroutine has reached co_return.