编译器错误 C3297

“constraint_2”:不能使用“constraint_1”作为约束,因为“constraint_1”具有值约束

值类已密封。 如果约束是值类,则永远无法从它派生其他约束。

有关详细信息,请参阅泛型类型参数的约束 (C++/CLI)

示例

下面的示例生成 C3297。

// C3297.cpp
// compile with: /clr /c
generic<class T, class U>
where T : value class
where U : T   // C3297
public ref struct R {};