Date
2010-03-17.00:00:00
Message id
2636

Content

According to 13.8.3.2 [temp.dep.type] paragraph 1, in a primary class template a name refers to the current instantiation if it is the injected-class-name or the name of the class template followed by the template argument list of the template. Although a template-id referring to a specialization of a template alias is described as “equivalent to” the associated type, a specialization of a template alias is neither of the things that qualifies as naming the current instantiation, so presumably the typename keyword in the following example is required:

    template <class T> struct A;
    template <class T> using B = A<T>;

    template <class T> struct A {
        struct C {};
        typename B<T>::C bc;  // typename needed
    };

(However, the list in 13.8.3.2 [temp.dep.type] may not be exactly what we want; it doesn't allow use of a typedef denoting the type of the current instantiation, either, but that presumably should be accepted.)

For analogous reasons, it should not be permitted to use a template alias as a nested-name-specifier when defining the members of a class template:

    template <class T> struct A {
        void g();
    };
    template <class T> using B = A<T>;
    template <class T> void B<T>::g() {} // error