Follow Us
  • Register
Errorbase is a collaborative writing project, that aims to build the largest trouble-shooting guide about all kinds of error messages.


0 votes

Full message: Error C3298: (constraint 1) : cannot use (constraint 2) as a constraint because (constraint 2) has the ref constraint and (constraint 1) has the value constraint

You cannot specify mutually exclusive characteristics for a constraint. For example, a generic type parameter cannot be constrained to both a value type and a reference type. Ex:

// compile with: /clr /c
where T : ref class
where U : T, value class   // C3298
public ref struct R {};

requested by (170k points)
edited by

Please log in or register to to add a solution for this error.