编译器错误 C2139
“type”:未定义的类不允许作为编译器内部类型特征“trait”的参数
传递给类型特征的一个参数无效。
注解
有关详细信息,请参阅编译器对类型特征的支持。
示例
下面的示例生成 C2139。
// C2139.cpp
// compile with: /EHsc
#include <iostream>
using namespace std;
template <class T>
struct is_polymorphic {
static const bool value = __is_polymorphic(T);
};
class C;
class D {};
class E {
public:
virtual void Test() {}
};
int main() {
cout << is_polymorphic<C>::value << endl; // C2139
cout << is_polymorphic<D>::value << endl; // OK
cout << is_polymorphic<E>::value << endl; // OK
}
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈