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
[dcl.fct.def.coroutine] Initializer of a non-block variable is also a resumer CWG2613 #5298
Conversation
There are also two special cases: /* case 1 */
int fun1(int a = (r.resume(), 0)){
return a;
}
int v1 = fun1();
/* case 2*/
int fun2(int a){
return a;
}
int v2 = fun2((r.resume(),0)); First, any function parameter belongs to function parameter scope, thus the variables introduced by parameter-declaration are non-block variables. This proposal intends to use initializer to clarify the issue. However, the clear point in the two cases is that the initializer, in either case, is |
I don't find anything ambiguous. In these two case, the |
According to the current proposal, the initializers |
I think this is a question of classification. When the |
If we do not intend to treat the initializer of the parameter as a resumer, the current proposal should be modified as
Note that the variable that belongs to a function parameter scope is also a non-block variable as per [basic.scope.block] p1
This can work if we clarify the definition of the wording "initializer" after fixing issues #4582 and #4584 |
I think the clarification of "non-block variable" should be handled in another issue/PR. [basic.start.dynamic] frequently uses the item "non-block variable", this PR just reuses the meaning in that section. I've added a cross reference for this use. |
[basic.start.dynamic] explicitly states: a non-block variable with static storage duration. However, we did not add that condition for the non-block variable in this PR. |
Thanks. It was my oversight. |
@GorNishanov, @lewissbaker could you kindly take a look? |
I am wondering if there is a more general wording than trying to enumerate all contexts that may resume the coroutine. |
I'm wondering whether this should go through CWG. Maybe we can just say "context" instead of "function or x or y or z" instead. |
@jensmaurer I would welcome that. |
I think we are just trying to say that when a coroutine suspends we return from the call to So can we say something along the following lines?:
|
I made CWG2613 for this. Better get larger buy-in for whatever term we end up using. |
I'm closing this pull-request; it's unlikely the core issue resolution will use exactly the phrasing proposed here. |
Fixes #5295