Am 27.06.2019 um 21:09 schrieb Martin:
The below compiles, and writes
1 2
Are indexes to properties intentionally allowed to take "var param"?
Btw it even compiles with an "out" param.
program Project1;
type
{ TFoo }
TFoo = class
private
function GetFoo(var AIndex: Integer): Integer;
public
property Foo[var AIndex: Integer]: Integer read GetFoo;
end;
{ TFoo }
function TFoo.GetFoo(var AIndex: Integer): Integer;
begin
Result := AIndex;
AIndex := AIndex+1;
end;
var a,i: integer;
f: TFoo;
begin
f := TFoo.Create;
i := 1;
a := f.Foo[i];
writeln(a,' ',i);
readln;
end.
I just tested with Delphi and it works there as well. So contrary to
what we thought this does not seem to be a bug...
Regards,
Sven
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel