Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stmt.return.coroutine] p3 the original function-body vs. the replaced function-body #5214

Open
xmh0511 opened this issue Jan 19, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jan 19, 2022

[stmt.return.coroutine] p3 states:

If p.return_­void() is a valid expression, flowing off the end of a coroutine's function-body is equivalent to a co_­return with no operand; otherwise flowing off the end of a coroutine's function-body results in undefined behavior.

which the bolded function-bodys refer to? Since [dcl.fct.def.coroutine] p5 states that

A coroutine behaves as if its function-body were replaced by...

If we argue that the replace function-body is just notional(i.e., the replacement process is not actually happened), I would say the expound in [dcl.fct.def.coroutine] p11 is anyway based on the replaced one.

The coroutine state is destroyed when control flows off the end of the coroutine or the destroy member function ([coroutine.handle.resumption]) of a coroutine handle ([coroutine.handle]) that refers to the coroutine is invoked.

Presumably, the end of the coroutine refers to the portion after co_await promise.final_suspend() ; in the replaced one. Maybe, there is room for improvement for the above provision in order to eliminate the ambiguity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant