“constraint_1”:不能使用“constraint_2”作为约束,因为“constraint_2”具有 ref 约束,而“constraint_1”具有值约束
不能为约束指定相互排斥的特征。 例如,不能同时将泛型类型参数约束为值类型和引用类型。
有关详细信息,请参阅泛型类型参数的约束 (C++/CLI)。
示例
下面的示例生成 C3298。
// C3298.cpp
// compile with: /clr /c
generic<class T, class U>
where T : ref class
where U : T, value class // C3298
public ref struct R {};