This documentation is archived and is not being maintained.

Compiler Error C3299

Error Message

'member_function' : cannot specify constraints, they are inherited from the base method

When overriding a generic member function, you cannot specify constraint clauses (repeating the constraints implies that the constraints are not inherited).

The constraint clauses on the generic function you are overriding will be inherited.

For more information, see Constraints.


The following sample generates C3299.

// C3299.cpp
// compile with: /clr /c
public ref struct R {
   generic<class T> 
   where T : R
   virtual void f();

public ref struct S : R {
   generic<class T> 
   where T : R   // C3299
   virtual void f() override;