cplusplus / nbballot

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

FR-004-003 8.6.5 [stmt.ranged] fix range-based "for" loop #407

Closed wg21bot closed 1 year ago

wg21bot commented 1 year ago

2012R2 illustrates a very real pitfall with the range base for loop that is intuitive for most C++ developers, and a localised solution to this problem could solve a large number of bugs, especially as ranges become more popular.

While we would welcome a more generalised solution to lifetime analysis, it would be a disservice to the C++ community to wait for a perfect general solution, which may not be possible at all, while this specific problem is easily fixed.

This is indeed not so much a problem of lifetime as it is a problem that the source code is translated to something surprising to users by compilers.

Please consider adopting something along the lines of P2012.

jfbastien commented 1 year ago

Duplicate of https://github.com/cplusplus/nbballot/issues/471

erichkeane commented 1 year ago

No objection to unanimous consent that this is a duplicate as stated above.