Show: Object Pascal C++
Display Preferences

E2268 Parameters of this type cannot have default values (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

The default parameter mechanism incorporated into the Object Pascal 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 Object Pascal 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.

Personal tools
In other languages