Closed
Description
[class.copy.assign]/7 says:
A defaulted copy/move assignment operator for class X is defined as deleted if X has:
…
(7.4) — a direct non-static data member of class type M (or array thereof) or a direct base class M that cannot be copied/moved because overload resolution, as applied to find M's corresponding assignment operator, results in an ambiguity or a function that is deleted or inaccessible from the defaulted assignment operator.
For the code
struct M {};
struct X {
const M m{};
};
(I assume) the intent is that the implicit copy assignment operator for X
shall be deleted. But:
M
's assignment operator is accessible and not deleted. "inaccessible" — is about access control, right?- Overload resolution is not ambiguous, because the set of viable functions chosen by [over.match.viable] is empty: there is no implicit conversion from
const M
implied object argument toM&
implicit object parameter ofM
's implicitly-declared copy assignment operator.
And If the set of candidate functions is empty, overload resolution is unsuccessful.
unsuccessful ≠ ambiguous. There is no ambiguity when there is nothing to select from.
Should only this paragraph be fixed or the fix for [over.match] is also required to say explicitly that unsuccessful overload resolution means ill-formed program (or vice versa), I don't know.