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 "pack" in [temp.variadic]#6 is not clear #4081

Open
xmh0511 opened this issue Jul 13, 2020 · 0 comments
Open

The wording "pack" in [temp.variadic]#6 is not clear #4081

xmh0511 opened this issue Jul 13, 2020 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jul 13, 2020

template<typename...T>
struct Test{
   static Test<T...> obj;
};

Consider the above code, T... within Test<T...> is called template-argument-list, thereof , T denotes template-argument which is one form of the following:

template-argument:

  • constant-expression
  • type-id
  • id-expression

Hence, To determine whether T satisfied the requirement of template-argument, the following rule will apply to it.

For the purpose of determining whether a pack satisfies a rule regarding entities other than packs, the pack is considered to be the entity that would result from an instantiation of the pattern in which it appears.

However the definition of wording pack is:

A pack is a template parameter pack, a function parameter pack, or an init-capture pack. The number of elements of a template parameter pack or a function parameter pack is the number of arguments provided for the parameter pack. The number of elements of an init-capture pack is the number of elements in the pack expansion of its initializer.

template parameter pack is:

If a template-parameter is a type-parameter with an ellipsis prior to its optional identifier or is a parameter-declaration that declares a pack ([dcl.fct]), then the template-parameter is a template parameter pack.

The grammar of template-parameter is the following:

template-parameter:

  • type-parameter
  • parameter-declaration

According to these rules, A pack refer to either type-parameter or parameter-declaration . In the example, It means typename...T is called the pack, So I think the wording is not clear or mistake. Maybe change it to:

For the purpose of determining whether the name of a pack satisfies a rule regarding entities other than packs, the name of a pack is considered to be the entity that would result from an instantiation of the pattern in which it appears.

In addition, only a pack expansion will result in instantiation of the pattern.

A pack expansion consists of a pattern and an ellipsis, the instantiation of which produces zero or more instantiations of the pattern in a list

A pack whose name appears within the pattern of a pack expansion is expanded by that pack expansion.

So, I think change the the pack to the name of a pack will make sense

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