-
Notifications
You must be signed in to change notification settings - Fork 18
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
CWG2804 Lookup for determining rewrite targets #1688
Comments
EWG discussed CWG2804 during the Tuesday Morning session in Kona. The following poll was taken. CWG2804 "Lookup for determining rewrite targets", the intent is to check for the existence of a declaration that differs only in the operator name (ie,
Result: Consensus |
@jensmaurer does this also resolve #1645 ? |
@jfbastien : Yes, but this for sure makes the example in #1645 ill-formed. But we intentionally made this example well-formed very recently. So, EWG seems to have reversed direction as far as the example in #1645 is concerned. |
The EWG decision partially reverts P2468R2 (The Equality Operator You Are Looking For), applied in July 2022. In particular, the line Back to EWG for confirmation of the intent. |
Tagging @zygoloid and... is Cameron not on github? What's his handle? |
Just so I understand, is the idea that the lookup for the corresponding Note: the programming model suggested in P2468R2 was that if the programmer writes a corresponding As for the standard reference: struct B {
bool operator==(const B&); // #2
};
struct C : B {
C();
C(B);
bool operator!=(const B&); // #3
};
bool c1 = B() == C(); // OK, calls #2; reversed #2 is not a candidate because search for operator!= in C finds #3 If we consider the programming model again, the sample should still compile as the scope S is |
My understanding of the programming model was that we use the fact that we find So no rewrites here: struct S {
bool operator==(const S&) /* not const */;
bool operator!=(const S&) /* not const */;
}; or here template <typename T>
struct Base {
bool operator==(const T&) const;
bool operator!=(const T&) const;
};
struct Derived : Base<Derived> { }; or here struct X {
operator int();
friend bool operator==(X, int);
friend bool operator!=(X, int);
} since these are all declared together. But in the standard reference example (that Cameron just cited) and in the struct Y {
operator int();
friend bool operator==(Y, int);
};
bool operator!=(Y, int); The But I don't super understand the other examples (the |
My understanding of the |
Beyond that, I'd like to remind all interested parties that this paper tracker is for administrative purposes only. Any technical discussion should happen elsewhere, e.g. on the reflectors. |
If we are still looking for a paper author, I would like to express interest and signup for authoring this. |
@usx95 has volunteered to write the paper, and I'm interacting with him offline to help get him started. So, author identified! |
EWG St. Louis: @usx95 volunteered to write a paper |
Some cases for synthesized equality operator candidates yield possibly surprising outcomes, owing to the details of the "rewrite target" rules.
CWG seeks the advice of EWG to possible improve or change these rules.
See CWG2804 for details.
The text was updated successfully, but these errors were encountered: