Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [dcl.fct.def.coroutine]
Link to reflector thread (if any):
Issue description:
CWG2465 clarified that the q1 is an lvalue that denotes *this for an implicit object member function. However, in a lambda expression whose operator() is an implicit object member function and a coroutine, *this doesn't denote the lambda closure object, and is possibly invalid (when neither this nor *this is captured).
Perhaps for a lambda expression we should specify q1 to be an lvalue that denotes the lambda closure object, and is const unless the lambda is mutable.
However, it seem that a captureless lambda should be handled as if the operator() is a static even if it's an implicit object member function. Otherwise, there would be behavioral difference between the operator() and the converted function pointer, as the latter can never have *this.
Suggested resolution:
Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [dcl.fct.def.coroutine]
Link to reflector thread (if any):
Issue description:
CWG2465 clarified that the q1 is an lvalue that denotes
*thisfor an implicit object member function. However, in a lambda expression whoseoperator()is an implicit object member function and a coroutine,*thisdoesn't denote the lambda closure object, and is possibly invalid (when neitherthisnor*thisis captured).Perhaps for a lambda expression we should specify q1 to be an lvalue that denotes the lambda closure object, and is
constunless the lambda ismutable.However, it seem that a captureless lambda should be handled as if the
operator()is a static even if it's an implicit object member function. Otherwise, there would be behavioral difference between theoperator()and the converted function pointer, as the latter can never have*this.Suggested resolution: