Date
2022-11-20.07:54:16
Message id
854

Content

Paragraph 6 of 13.8 [temp.res] is obsolete as result of issue 224, and needs to be revised.

Within the definition of a class template or within the definition of a member of a class template, the keyword typename is not required when referring to the unqualified name of a previously declared member of the class template that declares a type. The keyword typename shall always be specified when the member is referred to using a qual- ified name, even if the qualifier is simply the class template name. [Example:
  template<class T> struct A {
      typedef int B;
      A::B b;                     // ill-formed: typename required before A::B
      void f(A<T>::B);            // ill-formed: typename required before A<T>::B
      typename A::B g();          // OK
  };
]

Proposed Resolution:

Change 13.8 [temp.res] paragraph 6 as follows

Within the definition of a class template or within the definition of a member of a class template, the keyword typename is not required when referring to the unqualified name of a previously declared member of the class template that declares a type. The keyword typename shall always be specified when the member is referred to using a qualified name, even if the qualifier is simply the class template name. [Example:
template<class T> struct A {
    typedef int B;
    B b;                      // ok, no typename required
    A::B b;                   //  ill-formed: typename required before  A::B
    void f(A<T>::B);          //  ill-formed: typename required before  A<T>::B
    typename A::B g();        //  OK
};
The keyword typename is required whether the qualified name is A or A<T> because A or A<T> are synonyms within a class template with the parameter list <T>. ]