Compiler Error C3217
'param' : generic parameter cannot be constrained in this declaration
A constraint was ill formed; the constraint generic parameter must agree with the generic class template parameter.
The following sample generates C3217:
// C3217.cpp
// compile with: /clr
interface struct A {};
generic <class T>
ref class C {
generic <class T1>
where T : A // C3217
void f();
};
The following sample demonstrates a possible resolution:
// C3217b.cpp
// compile with: /clr /c
interface struct A {};
generic <class T>
ref class C {
generic <class T1>
where T1 : A
void f();
};
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for