似乎 VS 2008 处理类模板的继承与其他编译器略有不同。以下代码在 VS 2008 上编译没有任何错误(使用默认选项):
template <typename S, typename T>
class someclass : public non_existent_class
{
T operator() (S s) const {
return T(s);
}
};
问题是,为什么?由于 undefined identifier ,没有其他编译器能够做到这一点(尝试过 GCC 4.5.0、Intel、Online Comeau、VS 2005)non_existent_class
。也许是新的 C++0x 标准中的某些东西证明了这种行为?