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

Wording issue between [over.call.func] and [basic.lookup] #2365

Closed
brevzin opened this issue Oct 19, 2018 · 2 comments
Closed

Wording issue between [over.call.func] and [basic.lookup] #2365

brevzin opened this issue Oct 19, 2018 · 2 comments
Assignees

Comments

@brevzin
Copy link
Contributor

brevzin commented Oct 19, 2018

[over.call.func]/3 says:

In unqualified function calls, the name is not qualified by an -> or . operator and has the more general form of a primary-expression. The name is looked up in the context of the function call following the normal rules for name lookup in function calls.

[basic.lookup]/2 says:

A name “looked up in the context of an expression” is looked up as an unqualified name in the scope where the expression is found.

We can have an unqualified function call that nevertheless uses a qualified name (e.g. foo::bar(1)), but we're saying we have to look that name up using unqualified lookup instead of qualified lookup. That doesn't seem right. (h/t 9room)

@jensmaurer
Copy link
Member

The bug seems to be that [basic.lookup] p2 restricts itself to "unqualified names". That's also wrong for other uses of the phrase; e.g. [basic.lookup.classref] 6.4.5p6:

If the nested-name-specifier contains a simple-template-id (12.2), the names in its _template-argument_s are looked up in the context in which the entire postfix-expression occurs.

In fact, 6.4.5 [basic.lookup.classref] and 10.7 [class.member.lookup] conspicuously ignore each other, although they mostly talk about the same thing.

@RealLitb
Copy link

I think the issue is a misuse of "qualified name" by [over.call.func]. The term "name" is defined as not including the ::-es by [basic]p9 and p4, and that matches its use in the remainder of [basic]. From what I can see, in [basic] a "qualified name" is simply a name with a nested name specifier prepended. It's not the entire construct including the nested name specifier, as far as I can tell.

For example: [basic.lookup.qual]p4: "A name prefixed by the unary scope operator :: ([expr.prim.id.qual]) is looked up in global scope" - this means that in ::a::b, the a is looked up in global scope. But if you would consider both a and a::b as names, the rule becomes ambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants