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
[namespace.udecl]/17 Fix the note and comment to better reflect that … #749
[namespace.udecl]/17 Fix the note and comment to better reflect that … #749
Conversation
…while using declarations can aid in resolving certain member-lookup ambiguities, they are not always sufficient.
|
||
void f(D* d) { | ||
d->x(); // ambiguous: selected overload \tcode{x()} from the result of name lookup of \tcode{x} in implicit naming class \tcode{D} | ||
// (i.e. \{A::x(), C::x(int), D::x(double)\}) is a direct member of class \tcode{A} which is an ambiguous base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions:
- Every
x()
should probably just bex
-- distinguish the name from the call expression. This example is about names. - Make each term inside the braces appear in code font, e.g.
\tcode{A::x}
etc.
(@faisalv: Squash and force-push?) |
return d->x(); // ambiguous: \tcode{B::x} or \tcode{C::x} | ||
|
||
void f(D* d) { | ||
d->x(); // ambiguous: while member lookup of \tcode{x} in implicit naming class \tcode{D} is unambiguous, the selected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true regardless of the presence or absence of the _using-declaration_s in this example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - the using declaration simply helps to guide member lookup so that x() is not hidden.
@faisalv: Please rebase. |
@jensmaurer: This has been stuck for a long time. Could you perhaps take an unbiased look and check whether a) the original problem is actually bad, and b) if yes, perhaps draft some alternative wording that we could use instead? |
It seems to me what we really want to say here is that the using-declaration does help with name lookup issues, but doesn't help with the ambiguous base class conversion (from D to A). See pull request #1254. |
…while using declarations can aid in resolving certain member-lookup ambiguities, they are not always sufficient.
I admittedly got a little carried away by my prior attempt at this - hopefully this one is more restrained (pls let me know if the comment is still too wordy, and whether you want me to truncate it further or have suggestions)