I never saw a nested-name-specifier in an elaborated-type-specifier before this question, and at first glance I thought it wasn't even covered by the grammar. Now I see that since C++98 up to the present, it's translated as a special case without the typename-specifier construct. C++11 7.1.6.3/2 (7.1.5.3/2 in C++98):
3.4.4 describes how name lookup proceeds for the identifier in an elaborated-type-specifier. If the identifier resolves to a class-name or enum-name, the elaborated-type-specifier introduces it into the declaration the same way a simple-type-specifier introduces its type-name.
Therefore it would seem that although you can form a qualified elaborated-type-specifier, you need to take care that it's never type-dependent. Name resolution per 3.4.4 at template definition time will never find a class-name because dependent names are presumed to be objects unless prefixed with the typename keyword, which isn't grammatically allowed in this context.
Is this an accurate assessment of the meaning of the standard, and the design intent of the language?
Expanding from the comments:
Take this program as an example:
At template definition time, both
S2andS3are okay: 14.6p5 lists the exceptions wheretypenameis not required. Essentially: where the use is unambiguous because the name can never be anything other than a type,typenameis not required. This includes several cases wheretypenameis not syntactically allowed, so where requiringtypenamewould mean there is no way to write the program. Bothtypename struct S<T>::Iandstruct typename S<T>::Iare hard errors, andstruct S<T>::Iis unambiguous.At template instantiation time, the rules of 3.4.4 are clearer: both
struct S1<int>::Iandstruct S2<int>::Ican then be found, where it becomes apparent thatS2<int>::Iis a typedef, sostruct S2<int>::Iis an error. At the same time, at that point,S2<short>::Iis seen not to be a typedef, but a struct, sostruct S2<short>::Iis allowed.