cplusplus / nbballot

Handling of NB comments in response to ballots
14 stars 4 forks source link

DE-038 6.7.7 [class.temporary], 8.6.5 [stmt.ranged] Lifetime in range-based for loop #471

Closed wg21bot closed 1 year ago

wg21bot commented 1 year ago

Fix cwg900: Range-based for loop is broken with references to temporaries

For more than 14 years cwg900 is open now and it affects one of the key control structures of C++.

While we had an accepted proposed direction to fix it with P2012, the proposed wording was not accepted, because some people wanted to have a broader fix. But nothing happened. It is really important to accept now the proposed fix of P2012 because use of containers, tuples, optionals, variants, spans, getters that return references, and even coroutines that yield references in range-based for loops is affected. Therefore accept the proposed wording of P2012 to fix this still open bug.

Note that P2644R0 provides up-to-date proposed wording.

Apply P2644.

jfbastien commented 1 year ago

Paper is https://github.com/cplusplus/papers/issues/1316 Duplicated by https://github.com/cplusplus/nbballot/issues/407

erichkeane commented 1 year ago

Forward P2644R0 to CWG for inclusion in C++23.

SF F N A SA
25 16 2 2 2

Result: Consensus.

jfbastien commented 1 year ago

Note that I asked whether the paper had CWG review and implementation experience, and the answer was "no".

jensmaurer commented 1 year ago

CWG 2022-11-11: Reviewed D2718R0 for the wording.

jensmaurer commented 1 year ago

Accepted with Modifications. See P2718R0 for details.