Title
Coroutine parameters passed to a promise constructor
Status
cd6
Section
9.5.4 [dcl.fct.def.coroutine]
Submitter
Gor Nishanov

Created on 2020-10-19.00:00:00 last changed 27 months ago

Messages

Date: 2021-04-15.00:00:00

Proposed resolution (April, 2021):

  1. Change 9.5.4 [dcl.fct.def.coroutine] paragraph 4 as follows:

  2. In the following, pi is an lvalue of type Pi, where p1 denotes *this and pi+1 denotes the ith function parameter for a non-static member function, and pi denotes the ith function parameter otherwise. For a non-static member function, q1 is an lvalue that denotes *this; any other qi is an lvalue that denotes the parameter copy corresponding to pi, as described below.
  3. Change 9.5.4 [dcl.fct.def.coroutine] bullet 5.7 as follows:

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

    • ...

    • promise-constructor-arguments is determined as follows: overload resolution is performed on a promise constructor call created by assembling an argument list with lvalues p1 ... pn q1 ... qn. If a viable constructor is found (12.2.3 [over.match.viable]), then promise-constructor-arguments is (p1, ... , pn) (q1, ... , qn), otherwise promise-constructor-arguments is empty.

Date: 2022-02-18.07:47:23

Suggested resolution:

  1. Change 7.5.5.2 [expr.prim.id.unqual] paragraph 4 as follows:

  2. In the following, pi is an lvalue of type Pi, where p1 denotes *this and pi+1 denotes the ith function parameter for a non-static member function, and pi denotes the ith function parameter otherwise. Let qi be the corresponding parameter copy, as described below.
  3. Change 7.5.5.2 [expr.prim.id.unqual] bullet 5.7 as follows:

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

    • ...

    • promise-constructor-arguments is determined as follows: overload resolution is performed on a promise constructor call created by assembling an argument list with lvalues pq1 ... pqn. If a viable constructor is found (12.2.3 [over.match.viable]), then promise-constructor-arguments is (pq1, ... , pqn), otherwise promise-constructor-arguments is empty.

Date: 2021-06-15.00:00:00

[Accepted as a DR at the June, 2021 meeting.]

The resolution of issue 2436 (in P2107R0) deleted the sentence

A reference to a parameter in the function-body of the coroutine and in the call to the coroutine promise constructor is replaced by a reference to its copy.

replacing it with new wording in 7.5.5.2 [expr.prim.id.unqual] paragraph 1:

An identifier that names a coroutine parameter refers to the copy of the parameter (9.5.4 [dcl.fct.def.coroutine]).

This new approach no longer covers coroutine parameters passed to a promise constructor, since the constructor call is implicit, as described in 7.5.5.2 [expr.prim.id.unqual] paragraph 5.

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: drwp -> cd6
2022-02-18 07:47:23adminsetmessages: + msg6721
2021-11-15 00:00:00adminsetmessages: + msg6593
2021-11-15 00:00:00adminsetstatus: drafting -> drwp
2020-10-19 00:00:00admincreate