【发布时间】:2011-11-08 21:31:15
【问题描述】:
以下给出了 MSVC++ 10 Sp1 上的“内部编译器错误”。
在 gcc 上:
b.cpp:16:12: 错误:非命名空间范围‘struct A::B’中的显式特化
b.cpp:16:28: 错误:主模板声明中的模板 ID ‘f’
//class template
template< class T>
struct A{
//struct B {}; //Remove the comment and it will compile!
};
//partial specialization
template< class T >
struct A< T* >
{
struct B {
template<class C> void f(){}
//"Internal Compiler Error"
template<> void f<int>(){};
};
};
但是,如果 struct B 之前的 cmets 被删除,它将编译!
我不明白这个问题!
【问题讨论】:
-
首先,它不应该编译。你应该提交一份错误报告。这里没有问题,我们无法解释我们没有来源的代码中的错误。
-
这也不应该在删除注释的情况下编译。
-
@Alexandre C. 如果我知道这是一个错误,我会提交一个错误。但是使用 C++ 有时会变得非常棘手
-
@user578832:内部编译器错误总是是一个错误。