CWG Issue 2465 (original) (raw)

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-11-05


2465. Coroutine parameters passed to a promise constructor

Section: 9.6.4 [dcl.fct.def.coroutine]Status: CD6Submitter: Gor NishanovDate: 2020-10-19

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

Suggested resolution:

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

In the following, p_i_ is an lvalue of type P_i_, where p1 denotes *thisand p_i_+1 denotes the i_th function parameter for a non-static member function, and p_i denotes the i_th function parameter otherwise.Let q_i be the corresponding parameter copy, as described below.

  1. Change 7.5.5.2 [expr.prim.id.unqual] bullet 5.7 as follows:

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

Proposed resolution (April, 2021):

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

In the following, p_i_ is an lvalue of type P_i_, where p1 denotes *thisand p_i_+1 denotes the i_th function parameter for a non-static member function, and p_i denotes the i_th function parameter otherwise.For a non-static member function,q1 is an lvalue that denotes*this; any other q_i_is an lvalue that denotes the parameter copy corresponding to p_i, as described below.

  1. Change 9.6.4 [dcl.fct.def.coroutine] bullet 5.7 as follows:

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