C++ 从内部模板类专门化访问外部模板类typedefs

C++ 从内部模板类专门化访问外部模板类typedefs,c++,namespaces,inner-classes,class-template,C++,Namespaces,Inner Classes,Class Template,考虑以下代码 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> templa

考虑以下代码

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
};
模板
结构外部{
typedef int outertype;
模板结构内部;
};
模板模板结构外部::内部{
void f(outertype){}
};
模板模板结构外部::内部{
//void f(outertype){}//test.cpp:11:9:错误:“outertype”尚未声明
void f(outer::outertype){}//可以,但更详细
};

我高度怀疑注释中的错误是一个g++错误(4.8.2),还是名称查找规则中的一个奇怪的微妙之处?

对我来说奇怪的是,详细版本似乎不需要
typename
@Jarod42为什么?如果值或类型标识符存在歧义,则需要使用AIK
typename
,在这里我看不到任何歧义。如果改用
outer::outertype
,则需要
typename
。。。