-
Notifications
You must be signed in to change notification settings - Fork 769
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
[temp.arg.template] p4 Saying PP is an id-expression has a wrong assumption #5372
Comments
Even though id-expressions is introduced inside [expr], we use it in situations where it is not actually an expression. For example, for declarator-id in [dcl.decl.general]. I agree that id-expression should be moved outside of [expr], and only the parts relevent for [expr] should stay there (value category, result). |
Yes, since the declarator-id is an id-expression in grammar, which is reasonable that name lookup can interpret the name as an id-expression that is able to appear in an expression when that name appears in an expression. That is why I said id-expression may limit the template parameter as a non-type template parameter because that parameter's declaration has a declarator-id that is an id-expression. However, any type template parameter is introduced by an identifier, the lookup rules apply to the name shouldn't interpret that name as an id-expression, as we discussed in #5345 (comment) and #5341 (comment) Anyway, typedef-name and template-name are not comprised by the grammar of an id-expression. |
For template argument corresponding to template template-parameter, we have [temp.arg.template] p1 that specifies that the template-argument is expressed as id-expression. So, it could be arguably correct that we say However, we do not have a similar special phrase that specifies the type template-argument is expressed as an id-expression. [temp.arg.type] p1 says such a template-argument shall be a type-id.
type-id is not an id-expression and vice versa. BTW, [temp.arg.template] p1 requires that the template-argument for template template-paramter shall be the name of a class template or an alias template. It is unclear whether a name introduced by a template template-parameter can be considered to be a name of a class template or of an alias template or not? We do not have a relevant phrase. |
For the last point, I think we want [temp.param] p3 to say "... template-name that designates a template whose specializations are types". |
Is it [temp.arg.template] p1 instead of [temp.param] p3? I think [temp.arg.template] p1 might be changed to
How about the point that a type-id(especially, typedef-name) is not an id-expression? I think it also should be fixed. |
[temp.arg.template] is concerned with template arguments, i.e. the use of templates. [temp.param] is concerned with template parameters, i.e. the declaration and definition of templates. In order to properly syntax-check a template definition, I think we need to know that the identifier introduced via a template template parameter is actually (similar to) a class/alias template. Maybe we want to even say that those are alias templates. I think [temp.arg.template] is fine as-is; this is just another place where id-expression is used with a non-expression meaning (which ought to be fixed, but not like this). |
I also think so. So, there are two remaining issues, [temp.param] p3 might be fixed by:
Another issue is we should give a special rule to specify the name of a type template parameter (declared without template) whose name becomes a typedef-name is interpreted as an id-expression whenever it is used as a template-argument. |
The second bullet in [temp.arg.template] p4 says
The id-expression implies that PP can only be a non-type template parameter since whose declarator-id is an id-expression. The name of the type template parameter is either typedef-name or template-name, as per [temp.param] p3
Maybe, we change the last sentence to
is better?
The text was updated successfully, but these errors were encountered: