模板的依赖名称解析标准是否存在缺陷

Is it a defect in the standard about dependent name resolution for template

关于如何查找模板的依赖名,标准只给了这么一小句,没有了:

In resolving dependent names, names from the following sources are considered:

  1. Declarations that are visible at the point of definition of the template.
  2. Declarations from namespaces associated with the types of the function arguments both from the instantiation context ([temp.point]) and from the definition context.

考虑下面的代码

struct Test{
  using type = int;
};
// #1
template<typename T>
struct TMP{
  using type = typename T::type;
};
int main(){
  TMP<Test>::type v = 0;
}

对于这段代码,名称 type 确实是一个从属名称,因为 T 是一个模板参数,这里不是函数调用,所以,唯一相关的要点是数字 1。它只表示从属name shall be visible before the template definition, 这意味着在我的代码中,声明应该在 #1 处可见。实际上,typename T::type 是一个合格的 id,因此限定名称查找规则适用于它并且因为 T 是一个模板参数,所以查找操作应在给定模板参数之后发生,即在这种模板的特化实例化。但是我引用的引述并没有说明这一点。所以,我想知道这是标准的缺陷吗?如果我遗漏了任何在标准中对此进行解释的内容,请在这个问题中引用它们。

完成language-lawyer comments, in §"Unknown specializations" of this page

Within a template definition, certain names are deduced to belong to an unknown specialization, in particular,

  • a qualified name, if any name that appears to the left of :: is a dependent type that is not a member of the current instantiation
  • ...

在你的 struct TMP

  • 类型T确实是依赖类型
  • 表达式typename T::type是限定名,左边if::是依赖类型
  • 该表达式成为未知的专业化

然后说:

Members of unknown specialization are always dependent, and are looked up and bound at the point of instantiation as all dependent names

允许在实例化时查找TMP<Test>::type