IS是[temp.res]/p8覆盖的[temp.dep.type]/p7

Is [temp.dep.type]/p7 covered by [temp.res]/p8?

本文关键字:temp dep type p7 p8 res IS 覆盖      更新时间:2023-10-16

[temp.dep.type]/p7:

如果合格的ID nested-name-depifier 是指当前的实例化不是当前实例化的成员或该计划甚至是未知专业化的成员,即使如果未实例化包含合格的ID 的模板;不需要诊断。同样,如果类成员访问表达式对象表达式的类型当前的实例化不是指当前成员实例化或未知专业的成员,该计划是即使包含成员访问的模板,也不明显表达不是实例化的;无需诊断。[示例

template<class T> class A {
  typedef int type;
  void f() {
    A<T>::type i;               // OK: refers to a member of the current instantiation
    typename A<T>::other j;     // error: neither a member of the current instantiation nor
                                // a member of an unknown specialization
  }
};

- 结束示例]

[temp.res]/p8(省略了无关的部分(:

知道哪些名称是类型名称允许每个模板的语法被检查。该程序是不形式的,无需诊断,如果:

  • 不能为模板或替代constexpr if语句和模板中的constexpr生成有效的专业化模板未实例化,或

...

[示例

int j;
template<class T> class X {
  void f(T t, int i, char* p) {
    t = i;          // diagnosed if X​::​f is instantiated, and the assignment to t is an error
    p = i;          // may be diagnosed even if X​::​f is not instantiated
    p = j;          // may be diagnosed even if X​::​f is not instantiated
  }
  void g(T t) {
    +;              // may be diagnosed even if X​::​g is not instantiated
  }
};

...

- 结束示例]


我认为,如果满足[temp.dep.type]/p7中的条件,则无法为此模板生成有效的专业化(例如,在[temp的 example emame example 中.dep.type]/p7,对于声明typename A<T>::other j;(,无法生成有效的专业化,因此该程序的形式不正确;根据[temp.res]/p8。

不需要诊断。

那么[temp.res]/p8涵盖的[temp.dep.type]/p7?如果没有,您能举个例子,即[temp.dep.type]/p7覆盖,但[temp.res]/p8不覆盖?

是的,[temp.dep.type]/p7确实被[temp.res]/p8覆盖。

现在[temp.dep.type]/p7通过p1787完全删除,示例的一部分添加到[temp.res]/8。