The following code:
program Default_Issue;
function SomeFunction(var myVar : integer;
defaulted : boolean = true) : integer;
begin
writeln('Inside SomeFunction');
SomeFunction := 0
end;
var
i : integer;
begin
SomeFunction(i,true);
end.
Gets a compiler error pointing to the = sign in the function declaration:
Default_Issue.pas(3,64) Fatal: Syntax error, ")" expected but "=" found
The program will compile if the function declaration line has the default parameter value removed:
function SomeFunction(var myVar : integer;
defaulted : boolean) : integer;
In the Free Pascal manual it shows default parameters as an option for value parameters and the syntax appears to be "var-name : type = value" so I don't understand why I am getting the compiler error.