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

[over.match.oper] p6.2 Add a note for the synthesized <=> candidate #1926

Closed
jensmaurer opened this issue Feb 15, 2018 · 1 comment
Closed
Assignees

Comments

@jensmaurer
Copy link
Member

jensmaurer commented Feb 15, 2018

struct X {
  /* something */ operator<=>(const X&);   // member, compares X
};
X x;

struct Y : X { };
Y y;

x == x (obviously) works.
x == y gets us (x <=> y) == 0 which works (conversion on second param)

y == x: We check whether 0 == (x <=> y) works (yes, it does), so we add the
synthesized candidate

  op<=>(const X&, const X& implicit_obj_param)

to the candidate set for ==. The total candidate set for y==x is

  • op<=>(const X& implicit_obj_param, const X&);
  • op<=>(const X&, const X& implicit_obj_param); // #2

Then, we match y==x against this and we convert y to X (first param of #2).

What bothers me a bit is that the property "implicit object param" (which prevents conversions on that operand) is not explicitly mentioned as being swapped in 16.3.1.2p6.2.

@hsutter
Copy link

hsutter commented Feb 15, 2018

Would the following note suffice in [over.match.oper]/6.2.?

[Note: For this synthesized candidate, reversing the parameters includes reversing all their attributes, so that for a member function the implicit object parameter will be the second parameter. --end note]

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Feb 15, 2018
@jensmaurer jensmaurer self-assigned this Feb 16, 2018
@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Feb 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants