Open cor3ntin opened 1 year ago
In the following example, #1
and #2
have the same implicit object parameter type S&
, but they are not (and perhaps should still be not) of the same kind due to the ref-qualifier.
Perhaps we want #2
and #3
to be of the same kind.
struct S {
S& operator=(const S&) requires B1; // #1
S& operator=(const S&) & requires B2; // #2
S& operator=(this S&, const S&) requires B3; // #3
};
Possible resolution:
- they are both copy or move assignment operators that are implicit object member functions and with the same first non-object parameter type and the same cv-qualifiers ~and ref-qualifier, if any.~, and none of them has ref-qualifier, or
- they are both copy or move assignment operators with the same first non-object parameter type and the same object parameter parameter type, and none of them is an implicit object member function that has no ref-qualifier.
CWG2787
11.4.4.5 says
This seems to imply that
Are of the same kind (and we could presumably constrain one to make the other non-eligible).
We probably want to say instead
Two special member functions are of the same kind if [...] they are both copy or move assignment operators with the same first non-object parameter type and the
same cv-qualifiers and ref-qualifier, if anytype of their object parameter is the same.