编译器错误 C3393

constraint 子句有语法错误:“identifier”不是一个类型

传递给约束的标识符必须是一种类型,但该标识符不是一种类型。 有关详细信息,请参阅泛型类型参数的约束 (C++/CLI)

示例

以下示例生成 C3393:

// C3393.cpp
// compile with: /clr /c
void MyInterface() {}
interface class MyInterface2 {};

generic<typename T>
where T : MyInterface   // C3393
// try the following line instead
// where T : MyInterface2
ref class R {};