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

The wording about instantiation of a pack expansion in [temp.variadic] #4063

Closed
xmh0511 opened this issue Jun 29, 2020 · 0 comments
Closed

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jun 29, 2020

I wonder Is it a mis-wording in the following quote, that is

The instantiation of a pack expansion that is neither a sizeof... expression nor a fold-expression produces a list E1,E2,...En
, where N is the number of elements in the pack expansion parameters. Each Ei is generated by instantiating the pattern and replacing each pack expansion parameter with its ith element. Such an element, in the context of the instantiation, is interpreted as follows:

  • if the pack is a template parameter pack, the element is a template parameter of the corresponding kind (type or non-type) designating the type or value from the template argument; otherwise,
  • if the pack is a function parameter pack, the element is an id-expression designating the function parameter that resulted from the instantiation of the pattern where the pack is declared.

The pattern of a function parameter pack is a parameter-declaration without ellipsis. A usual parameter-declaration consists of :

  • attribute-specifier-seq (opt) decl-specifier-seq declarator
  • attribute-specifier-seq (opt) decl-specifier-seq declarator = initializer-clause
  • attribute-specifier-seq (opt) decl-specifier-seq abstract-declarator(opt)
  • attribute-specifier-seq (opt) decl-specifier-seq abstract-declarator (opt) = initializer-clause

In any case , the decl-specifier-seq is not an optional component.

In this example

template<typename...T>
void func(T...args){
}

T...args is a function parameter pack, thereof, T args is its pattern. So my issues is, why the element generated from instantiation of a pattern of a function parameter pack is id-expression, However the id-expression is only a part of declarator of a parameter-declaration.

@xmh0511 xmh0511 closed this as completed Jul 13, 2020
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

1 participant