Delphi Error – E2603 Constraint ‘%s’ cannot be specified more than once

Delphi Compiler Error

E2603 Constraint ‘%s’ cannot be specified more than once

Reason for the Error & Solution

This occurs whenever you try to specify a generics constraint more than once.

type
  TFoo<T: constructor, constructor> = class // issues error: E2603 'constructor'
  end;
  TBar<T: class, class> = class             // issues error: E2603 'class'
  end;
  TBaz<T: record, record> = class           // issues error: E2603 'record'
  end;
end.

This can be solved by removing the extra constraint:

type
  TFooOK<T: constructor> = class // OK
  end;
  TBarOK<T: class> = class       // OK
  end;
  TBazOK<T: record> = class      // OK
  end;
end.

See Also

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...