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.variadic] p6 Rearrange the rule and make the meaning clearer #5553
Comments
The word "entities" in the quote does not mean "entities" as specified in [basic.pre] p1, I think (for example, a typedef-name is not an entity). And since the pattern can transform a pack into a different syntactic thing (for example, from type to expression), the "considered to be" wording is just wrong, because it mixes levels. I think we should not try to differentiate semantic and syntactic rules here. |
In the origin rule, the "entity" is just misleading since we basically refer to these entities defined in [basic.pre] p3 when we mention it in this document. This is also implied by this phrase
A pack is an entity defined in [basic.pre] p3. The clarification is just want to make the pack that appears in a construct can be first validated by the relevant grammar(syntax), such as an id-expression cannot appear in a type-specifier, and not try to differentiate semantic and syntactic rules here. The thought is to give the pack a grammatical category, in other words, clearly know whether the pack is interpreted as a typedef-name, or id-expression, or a template-name. For example, initializer-list is defined as:
{ T... }; Given the construct, it is ok if
As above said, consider this example template<class...T>
void show(){
auto c = {T...};
} it is just wrong, |
We agree about the intent of the rule, but what exactly is wrong with the current formulation other than the unfortunate mention of "entity" (which is defined to mean something else)? |
Except for "entities", the remaining wording seems good to me. We may fix it with other approaches. |
[temp.variadic] p6 says
Actually, we also want to check the requirement for syntax where the pack appears but not just the rules for entities. For example:
At
#1
, we want to consider the packT
as a typedef-name, and unsigned typedef-name is not a valid combination of simple-type-specifiers summarized in [dcl.type.simple] p3, hence the combination is invalid.Rearrange [temp.variadic] p6 to the place after [temp.variadic] p8, and change it to
The pack
T
interpreted as a typedef-name can form a base-specifier at#1
and a nested-name-specifier at#2
. The packU
interpreted as a typedef-name can form a type-id at#3
however the typedef-name that designates the entityvoid
in the instantiation context forms a reference to void, which is ill-formed.The text was updated successfully, but these errors were encountered: