Delphi Error – E2268 Parameters of this type cannot have default values

Delphi Compiler Error

E2268 Parameters of this type cannot have default values

Reason for the Error & Solution

The default parameter mechanism incorporated into the Delphi compiler allows only simple types to be initialized in this manner. You have attempted to use a type that is not supported.

program Produce;
type
  ArrayType = array [0..1] of integer;

  procedure p1(proc : ArrayType = [1, 2]);
  begin
  end;
end.


Default parameters of this type are not supported in the Delphi language.

program solve;
type
  ArrayType = array [0..1] of integer;

  procedure p1(proc : ArrayType);
  begin
  end;

end.


The only way to eliminate this error is to remove the offending parameter assignment or to change the type of the parameter to one that can be initialized with a default value.