Am 28.06.2019 um 10:39 schrieb Martin Frb:
On 28/06/2019 07:39, Sven Barth via fpc-devel wrote:
Am 27.06.2019 um 21:09 schrieb Martin:
{ TFoo }
TFoo = class
private
function GetFoo(var AIndex: Integer): Integer;
public
property Foo[var AIndex: Integer]: Integer read GetFoo;
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...
What does Delphi do with
property Foo[AIndex: Integer; BIndex: Integer = 0]: Integer read
GetFoo;
Because FPC rejects this one. (And IMHO rightfully so)
Assuming that GetFoo is declared as "function GetFoo(AIndex: Integer):
Integer" It fails with "E2250: There is no overloaded variant of
'GetFoo' that can be called with these arguments" (or however that error
message is translated to English.
The following also fails:
=== code begin ===
function GetFoo(AIndex: Integer; BIndex: Integer): Integer;
property Foo[AIndex: Integer; BIndex: Integer = 0]: Integer read GetFoo;
=== code end ===
However this works:
=== code begin ===
function GetFoo(AIndex: Integer; BIndex: Integer = 0): Integer;
property Foo[AIndex: Integer; BIndex: Integer = 0]: Integer read GetFoo;
=== code end ===
As does this:
=== code begin ===
function GetFoo(AIndex: Integer; BIndex: Integer = 0): Integer;
property Foo[AIndex: Integer; BIndex: Integer]: Integer read GetFoo;
=== code end ===
Regards,
Sven
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel