cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.72k stars 752 forks source link

[dcl.fct.def.coroutine]: Initialization of the copy of a parameter of a coroutine #7383

Open RazvanAM opened 2 weeks ago

RazvanAM commented 2 weeks ago

[dcl.fct.def.coroutine] paragraph 13 states the following:

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. [...]

Considering the following coroutine:

task<void> f(int& p)
{
   ...
}

the copy of the parameter p has type int& and it is initialized with an xvalue, which should not be legal.

Is there something else that I might be missing?

Thank you!

xmh0511 commented 1 week ago

See https://github.com/cplusplus/CWG/issues/43

RazvanAM commented 1 week ago

I see, so the issue is already being discussed. Thank you!