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

[dcl.fct.def.coroutine] p13 A valid reference type is not cv-qualified #4868

Closed
xmh0511 opened this issue Sep 6, 2021 · 4 comments
Closed

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Sep 6, 2021

When a coroutine is invoked, after initializing its parameters ([expr.call]), a copy is created for each coroutine parameter. For a parameter of type cv T, the copy is a variable of type cv T with automatic storage duration that is direct-initialized from an xvalue of type T referring to the parameter.

When the parameter has a reference type, cv T is the wrong exposition. Maybe, we could say

When a coroutine is invoked, after initializing its parameters ([expr.call]), a copy is created for each coroutine parameter. For a parameter of type cv T or of type reference to cv T, the copy is a variable of the corresponding type with automatic storage duration that is direct-initialized from an xvalue of type T referring to the parameter.

@xmh0511 xmh0511 changed the title [dcl.fct.def.coroutine] p13 A valid reference type has not cv qualification [dcl.fct.def.coroutine] p13 A valid reference type is not cv-qualified Sep 6, 2021
@jensmaurer
Copy link
Member

If T is a reference type, then "cv" is simply empty (because references cannot be cv-qualified). I'm not seeing a problem here.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Sep 6, 2021

If T is an lvalue reference type, how could an expression be an xvalue of an lvalue reference type? Since [expr.type] p1 says

If an expression initially has the type “reference to T” ([dcl.ref], [dcl.init.ref]), the type is adjusted to T prior to any further analysis.

Instead, we say "xvalue of type T" where T may reference type in [dcl.fct.coroutine] p13, they seem to conflict.

@jensmaurer
Copy link
Member

That's a valid point, but unrelated to the subject of this issue, which talks about cv-qualification.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Sep 6, 2021

Well, actually this issue has two concerns here. I will post a new issue about the second one. This should be closed.

@xmh0511 xmh0511 closed this as completed Sep 6, 2021
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

2 participants