Skip to content

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

Description

@jensmaurer

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.

Activity

  1. changed the title [-]CWG2797: Meaning of "corresponds" for rewritten operator candidates[/-] [+]CWG2797 Meaning of "corresponds" for rewritten operator candidates[/+] on Oct 16, 2023
  2. erichkeane commented on Mar 18, 2024

    @erichkeane
    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.

  3. added and removed
    EWGEvolution
    on Mar 18, 2024
  4. moved this to Ready for review in CWGon Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      Awaiting updated wording

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions