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

[basic.lookup.unqual] p5 The component names of a type-specifier or ptr-operator are underspecified #5221

Open
xmh0511 opened this issue Jan 21, 2022 · 4 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jan 21, 2022

An unqualified name that is a component name ([expr.prim.id.unqual]) of a type-specifier or ptr-operator of a conversion-type-id is looked up in the same fashion as the conversion-function-id in which it appears.

The component names of a type-specifier is not explicitly specified in subclause [dcl.type.general]. As well, the component names of a ptr-operator is not specified in subclause [dcl.decl.general].

A type-specifier is

  • simple-type-specifier
  • elaborated-type-specifier
  • typename-specifier
  • cv-qualifier

The component names of the first three components are specified in their respective subclauses. However, a type-specifier can be a simple-type-specifier or any other component in the list, but we cannot conversely say any component in the list is called type-specifier. So, we should explicitly specify what component names of a type-specifier are.

The component names of a type-specifier are those of the simple-type-specifier, the elaborated-type-specifier, or the typename-specifier.

As well,

ptr-operator:

    • attribute-specifier-seqopt cv-qualifier-seqopt
  • & attribute-specifier-seqopt
  • && attribute-specifier-seqopt
  • nested-name-specifier * attribute-specifier-seqoptcv-qualifier-seqopt

we can say a ptr-operator is any component in the list but not the other way around. So, we should explicitly specify what component names of a ptr-operator are.

The component names of a ptr-operator are those of its nested-name-specifier(if any).

@jensmaurer
Copy link
Member

@opensdh, it seems reasonable to define component names of type-specifier and ptr-operator by explicit recursive decomposition. What do you think?

@opensdh
Copy link
Contributor

opensdh commented Jul 1, 2022

I wrote down to address this in P2449.

In general, I don't think it's all that important, since "a component name of a type-specifier" isn't all that different from "a component name of a thing (which is a simple-type-specifier, elaborated-type-specifier, or typename-specifier) that is a type-specifier". More problematic would be if we defined the component names of a type-specifier and then made use of the component names of (say) a typename-specifier in a context where it was not interpreted as a type-specifier.

That said, the ptr-operator case is a little more serious, since we have to read it as "a component name contained by a ptr-operator" and then we have to worry about how directly it is contained.

@opensdh
Copy link
Contributor

opensdh commented Jul 1, 2022

Of course, upon rechecking I see that P1787R6 already specified the component names for a ptr-operator!

@xmh0511
Copy link
Contributor Author

xmh0511 commented Jul 1, 2022

More problematic would be if we defined the component names of a type-specifier and then made use of the component names of (say) a typename-specifier in a context where it was not interpreted as a type-specifier.

Anyway, the terminal name of a typename-specifier is said to be in type-only context, according to [temp.res.general] p4. if such interpretation is wrong in the instantiation context, it will violate [temp.res.general] p6, especially bullet 6.5.

The basic logic in this issue is a higher-level syntax is a superset of a lower-level syntax, so any properties of the lower-level syntax can be included by the higher-level one but not vice versa. In the first rule, we say the component name of a type-specifier that is a higher-level syntax than anyone in the list, so we should explicitly say what the properties(i.e. component names) of the higher-level syntax are.

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