[fpc-devel] Method pointers to RECORD methods
Sven Barth
pascaldragon at googlemail.com
Wed Dec 16 22:44:22 CET 2020
Am 16.12.2020 um 15:01 schrieb Blaise--- via fpc-devel:
> The patch http://hg.blaise.ru/public/fpc/rev/0a8aff8d8273 (attached)
> fixes the following:
> -------8<-------
> {$Mode Delphi}
>
> type R = record
> var X: Integer;
> function Foo: Integer;
> end;
>
> function R.Foo: Integer;
> begin
> result := X
> end;
>
> var F: function : Integer of object;
> Z: R = (X:42);
> begin
> // EXPECTED: gets compiled
> // ACTUAL: 'Error: Incompatible types'
> F := Z.Foo;
> writeln( F() = 42 )
> end.
> -------8<-------
>
> The patch does not check for m_delphi: I did not came up with a case
> where that would make a semantic difference.
Hadn't thought that Delphi allows this... anyway, applied in r47794.
Regards,
Sven
More information about the fpc-devel
mailing list