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. -- βþ
# HG changeset patch # User Blaise.ru # Date 1608125930 -10800 ! tprocdef.is_methodpointer: allow method pointers to RECORD methods diff -r 6a8b4a8fc96e -r 8dc95aab5009 symdef.pas --- a/symdef.pas Tue Dec 15 20:45:13 2020 +0300 +++ b/symdef.pas Wed Dec 16 16:38:50 2020 +0300 @@ -6636,7 +6636,7 @@ begin { don't check assigned(_class), that's also the case for nested procedures inside methods } - result:=(owner.symtabletype=ObjectSymtable)and not no_self_node; + result:=(owner.symtabletype in [recordsymtable,ObjectSymtable]) and not no_self_node; end;
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel