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

--- Comment #13 from Iain Sandoe <iains at gcc dot gnu.org> ---

[IMO] I would suggest that GCC's behaviour (now) is the correct one [intended
by the design].


Consider a request such as made by Ville "I want the ramp return object to be
able to tell me if the coroutine suspended or completed".  Noting that there
are several ways in which a coroutine *might* run to completion before the ramp
returns.

That check cannot be made by looking at the promise object, since that object
has been destroyed in a completed coroutine (and, of course, even trying to
look at the promise - or continuing via a handle is UB).

So to fulfil such a request, the information must reasonably be presented in
the ramp's return object - and that implies that the coroutine body must be
able to update said object.  [Of course, one can consider other mechanisms with
additional shared state - but that seems terribly convoluted when we already
have a suitable place].

Reply via email to