Allowed, but only with qualified names:
TypeName specifier:
typename identifier identifier - template opt simple-template-id
So typename E is not correct according to the grammar. typename N::E is not the same as a qualified name. The third case, typename ::E , is excellent because :: is a valid nested qualifier.
The C ++ 03 standard indicates in [temp.res] / 5 that
The typename keyword should only apply to qualified names, but these names should not be dependent.
In the C ++ 11 standard, this is not explicitly stated, but inside the note in [temp.names] / 5:
[Note. As with the typename prefix, template prefix is ββallowed in cases where it is not strictly necessary; those. when a nested name specifier or expression to the left of -> or . independent of template parameter or usage not displayed within the template. - final note]
The same note exists in the same place in the C ++ 14 standard.
source share