-
Notifications
You must be signed in to change notification settings - Fork 772
[basic.lookup.argdep] should also perform if function declaration is not found #5209
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
Comments
Same logic as in the start of the (non-)issue description can be applied here: «for an expression» implies/asserts that the lookup has already been performed and we know that we have a postfix-expression, and not, say, typename-specifier, before
Your rewrite, ignoring weird use of «any» and «all» together, means (among other things) that one needs to find a block declaration of a function which is a declaration of not a function at the same time. |
You're right. I was aware of that issue, however, declaration not of a function or function template has announced that the unqualified-id cannot be a type entity. This part is similar to this issue #4791. Maybe, we should introduce
It's not true, since [basic.lookup.general] says that:
This means that a grammar component relying on the properties of a declaration is checked after the name lookup has determined what the declaration is(e.g., whether the name denotes a type or other entities, which will determine whether the expression is a function call or a explicit type conversion). |
Doesn't this mean that
is checked after lookup and there is no problem in saying
|
The key point here is that a normal unqualified name lookup does not yet find any declaration for the name. At this point, we don't know what the entity that name denotes since we cannot associate the name with any declaration. Then, ADL should also perform for this name, but as aforementioned, we cannot say the name definitely denotes a function, at least before ADL finds any declaration. |
[basic.lookup.argdep] p1 says
This implies/asserts that the unqualified name lookup at least finds one function or function template declaration because [expr.call] p1 says that:
In other words, if the postfix expression is not of function type or function pointer type, "a postfix expression followed by parentheses..." cannot be considered as a function call(e.g., Explicit type conversion (functional notation)).
Consider this exmple:
The unqualified name lookup for
fun
at#1
will find nothing however ADL can find the function declaration inA::B
. Should we say that?Seems that the "or" in the original list should be removed and should be replaced with "and" instead. Actually, only all bullets are satisfied will ADL perform for that name. However, "or" sounds like that merely needs one of the bullets to be satisfied. Also, we should admit that ADL only performs for an unqualified name after the unqualified name lookup has been completed and only if the result of that unqualified name lookup does not violate the above bullets.
In this example, unqualified name lookup does find the class definition at
#2
, merely, it is discarded from the result. So, we say "the result of the unqualified lookup ([basic.lookup.unqual]) for the name does not include any..." seems to be clearer.The text was updated successfully, but these errors were encountered: