【发布时间】:2018-03-12 01:19:36
【问题描述】:
有谁知道为什么以下编译失败(在 MSVC2015 中测试)?
template<int N> // when this line is removed it compiles successfully
class A {
class B {
public:
class C {
};
};
void func(B b){} // compiles fine
void func(B::C c){} // generates warning C4346 and error C2061
};
它在标有注释的行上生成以下内容:
warning C4346: 'A<N>::B::C': dependent name is not a typeerror C2061: syntax error: identifier 'C'
【问题讨论】:
标签: c++ templates visual-c++ compiler-errors