如何理解"abstract-declarator containing an ellipsis shall only be used in a parameter-declaration"

How to understand "abstract-declarator containing an ellipsis shall only be used in a parameter-declaration"

考虑下面的引用,它说:
[dcl.fct]/16

A declarator-id or abstract-declarator containing an ellipsis shall only be used in a parameter-declaration.[...]

我同意包含省略号的 declarator-id 只能用于参数声明,因为我们不能在任何地方使用像 ...id-expression 这样的东西,它只能出现在参数声明中,所以它是 100% clear.However,关于 包含省略号的抽象声明符只能在参数声明中使用,请考虑下面的代码:

#include <iostream>
#include <tuple>
template<typename...T>
void func(T...){
  std::tuple<T...> tup;  //#1
}

[dcl.name]

type-id:

type-specifier-seq abstract-declarator(opt)

怎么样#1,它不是参数声明,但是,包含省略号的抽象声明符在type-id中使用[=37] =],我对abstract-declarator的理解错了吗?

省略号不是 type-id 的一部分,而是 template-argument-list 的一部分。

如果我们应用[temp.names]

中的以下语法
simple-template-id:
    template-name < template-argument-listopt >

template-name:
    identifier

template-argument-list:
    template-argument ...opt
    [...]

template-argument:
    type-id
    [...]

根据您的示例,我们得到:

   std::tuple<T...> tup;
//      tuple<T...>       simple-template-id
//      tuple             template-name
//            T...        template-argument-list
//            T           template-argument, type-id

然后,[temp.arg]/9

A template-argument followed by an ellipsis is a pack expansion.

适用,这正是我们所期望的。