There's a template function f that requires its template parameter type T to have an inner class named Inner.
Inside f the class T::Inner shall be instantiated.
First try.
//
// "error: need 'typename' before 'T:: Inner' because 'T' is a dependent scope"
//
template <typename T>
void f( void )
{
T::Inner i;
}
I get that, so here comes the second try, where I don't get what's wrong:
/// "error: expected ';' before 'i'
template<typename T>
void f ( void )
{
typename T::Inner I;
I i;
}
Why is that?
In my understanding: Inner is declared as type. The template has not yet been instantiated. Whether the type Inner exists or not first becomes relevant on instantiation - not definition. Where am I going wrong?