次のコードを検討してください
template<int>
struct outer{
typedef int outertype;
template<int=0, int=0> struct inner;
};
template<int o> template<int,int> struct outer<o>::inner{
void f(outertype){}
};
template<int o> template<int i> struct outer<o>::inner<0,i>{
//void f(outertype){} //test.cpp:11:9: error: ‘outertype’ has not been declared
void f(outer<o>::outertype){} //ok but more verbose
};
コメントのエラーは g++ のバグ (4.8.2) ではないかと強く疑っています。