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

CWG2797 Meaning of "corresponds" for rewritten operator candidates #1645

Open
jensmaurer opened this issue Oct 6, 2023 · 1 comment
Open
Labels
CWG Core
Projects

Comments

@jensmaurer
Copy link
Member

jensmaurer commented Oct 6, 2023

There are special rules around rewritten operator candidates that make the following example well-formed, because the example appears in existing code bases:

  struct B {
    bool operator==(const B&);
  };
  struct C : B {
    C();
    C(B);
    bool operator!=(const B&);
  };
  bool c1 = B() == C();    // should be OK

Due to unrelated changes, the current wording makes this example ill-formed (because the two member operators have different object parameter types). This was not intended.

While fixing this, should the special rules be extended to also cover member operators with explicit object parameters? It seems unlikely that a new feature such as explicit object parameters would appear in a code base that also uses rather baroque combinations of comparison operators.

See CWG2797 for more details.

@jensmaurer jensmaurer added the EWG Evolution label Oct 6, 2023
@jfbastien jfbastien changed the title CWG2797: Meaning of "corresponds" for rewritten operator candidates CWG2797 Meaning of "corresponds" for rewritten operator candidates Oct 16, 2023
@erichkeane
Copy link
Collaborator

EWG discussed this during the Monday AM session in Tokyo. The following Poll was taken:

CWG2797 should be fixed with CWG2804, with a paper.

SF F N A SA
1 3 4 1 0

Result: Not Consensus

CWG2797- the special rules should be extended to also cover member operators with explicit object parameters:

SF F N A SA
1 0 4 1 1

Result: Not Consensus either way

Sending back to CWG: EWG has no consensus to extend to explicit object params.

@erichkeane erichkeane added CWG Core and removed EWG Evolution labels Mar 18, 2024
@jensmaurer jensmaurer added this to Ready for review in CWG Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CWG Core
Projects
CWG
Ready for review
Development

No branches or pull requests

2 participants