Skip to content

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

Open
@xmh0511

Description

@xmh0511
Contributor
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @xmh0511

        Issue actions

          The wording "pack" in [temp.variadic]#6 is not clear · Issue #4081 · cplusplus/draft