Please consider the following code
````
template<class T> struct A {
typedef int M;
struct B {
typedef void M;
struct C;
};
};
template<class T> struct A<T>::B::C : A<T> {
M m; // OK, A<T>::M
};
````
It is an example written in
[temp.dep.type]. whether the name `A<T>` is a current-instantiation name is determined by the following rules:
>> in the definition of a primary class template or a member of a primary class template, the name of the class template followed by the template argument list of the primary template (as described below) enclosed in <> (or an equivalent template alias specialization),
I have to say that the class `C` is a direct member of the class `B` which in turn is the direct member of the class template `A`, however I have not find any rule in the standard says that such a member of a nested class is also be considered as a member of enclosing classes. I only find the definition of the wording "direct member", that is:
>A direct member of a class X is a member of X that was first declared within the member-specification of X, including anonymous union objects ([class.union.anon]) and direct members thereof.
In order to does not violate the rule "In the definition of a class or class template, the scope of a dependent base class is not examined during unqualified name lookup either at the point of definition of the class template or member or during an instantiation of the class template or member. "
The class `C` should be considered as a member of the enclosing template class `A`.