[fpc-pascal] Overloaded functions

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Sat Oct 28 22:58:33 CEST 2017


Hi,

I have a problem with overloaded functions. I defined these functions:
function val_(name: string): string;
function val_(name: string): boolean;
function val_(name: string): integer;
function val_(name: string): double;

var
  res: boolean;
begin
  res := val_(option_variable);
end;

I get the following error: Error: Incompatible types: got "ShortString"
expected "Boolean". So for some reason the compiler is looking at the
first function. The mode is objfpc and I turned ansistrings off. I
tested by adding the overload modifier but without result. What else
could I try or do? Or is overloading only allowed for different
parameter lists?

Rgds, Darius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20171028/460823c7/attachment.html>


More information about the fpc-pascal mailing list