E2250 There is no overloaded version of '%s' that can be called with these arguments (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

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

An attempt has been made to call an overloaded function that cannot be resolved with the current set of overloads.


program Produce;

procedure f0(a : integer); overload;
begin
end;

procedure f0(a : char); overload;
begin
end;

begin
  f0(1.2);
end.


The overloaded procedure f0 has two versions: one which takes a char and one which takes an integer. However, the call to f0 uses a floating point type, which the compiler cannot resolve into neither a char nor an integer.


program Solve;

procedure f0(a : integer); overload;
begin
end;

procedure f0(a : char); overload;
begin
end;

begin
  f0(1);
end.

You can solve this problem in two ways: either supply a parameter type which can be resolved into a match of an overloaded procedure, or create a new version of the overloaded procedure which matches the parameter type.

In the example above, the parameter type has been modified to match one of the existing overloaded versions of f0.