cplusplus / nbballot

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

Late-CH01 11.3.5 [class.copy.assgn] p2,5 Defaulted copy and move assignment should have ref-qualifier #375

Closed jensmaurer closed 4 years ago

jensmaurer commented 4 years ago

The defaulted copy and move assignment operator are unqualified and as such callable on an rvalue ( 12.3.1 over.match.funcs p5.1 ) however they return an lvalue reference to *this.

Proposed change: Do tell the truth and make the compiler provided assignment operators ref-qualified:

X& X::operator=(const X&) &
X& X::operator=(X&) &
X& X::operator=(X&&) &

This defect should be applied retroactively to all revisions from C++11 on. Alternatively the rule 12.3.1. p5.1 could be made exempt of assignment operators

jfbastien commented 4 years ago

See https://github.com/cplusplus/papers/issues/652

jfbastien commented 4 years ago

EWG Monday: http://wiki.edg.com/bin/view/Wg21belfast/Late-CH01

Does EWG want this for C++20?

F A
0 34

No consensus for change.

jensmaurer commented 4 years ago

Rejected. There was no consensus to adopt this change.