Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[class.copy.assign]/7.4 CWG 1499: misses the unsuccessful overload resolution case #2179

Open
languagelawyer opened this issue Jun 13, 2018 · 3 comments
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.

Comments

@languagelawyer
Copy link
Contributor

languagelawyer commented Jun 13, 2018

[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:

  1. M's assignment operator is accessible and not deleted. "inaccessible" ­— is about access control, right?
  2. 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 to M& implicit object parameter of M'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.

@jensmaurer jensmaurer changed the title [class.copy.assign]/7.4 misses the unsuccessfull overload resolution case [class.copy.assign]/7.4 misses the unsuccessful overload resolution case Jun 14, 2018
@jensmaurer
Copy link
Member

We usually just say "overload resolution fails" when we mean any of the failure cases, including not having a viable function to start with.

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Jun 14, 2018
@jensmaurer
Copy link
Member

Editorial meeting: Not editorial (has normative impact).

@jensmaurer jensmaurer added cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. and removed decision-required A decision of the editorial group (or the Project Editor) is required. labels Nov 6, 2018
@jensmaurer jensmaurer changed the title [class.copy.assign]/7.4 misses the unsuccessful overload resolution case [class.copy.assign]/7.4 CWG 1499: misses the unsuccessful overload resolution case Nov 6, 2018
@jensmaurer
Copy link
Member

CWG 1499

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.
Projects
None yet
Development

No branches or pull requests

2 participants