“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
}