mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-11 09:18:10 +02:00

can create ambiguities for the parser in case the field names also exist as modifiers (TP- and Delphi-compatible, mantis #13971) + tests * fixed tests that broke because of this change git-svn-id: trunk@13334 -
28 lines
577 B
ObjectPascal
28 lines
577 B
ObjectPascal
{$mode objfpc}
|
|
type
|
|
tc = class
|
|
left,right: tc;
|
|
function test(var c: tc): boolean;
|
|
end;
|
|
|
|
testfunc = function(var c: tc):boolean of object;
|
|
|
|
function foreach(var c: tc; p: testfunc): boolean;
|
|
begin
|
|
if not assigned(c) then
|
|
exit;
|
|
end;
|
|
|
|
|
|
function tc.test(var c: tc): boolean;
|
|
begin
|
|
{ if you use @test, the compiler tries to get the address of the }
|
|
{ function result instead of the address of the method (JM) }
|
|
result := foreach(c.left,@self.test);
|
|
result := foreach(c.right,@self.test) or result;
|
|
end;
|
|
|
|
|
|
begin
|
|
end.
|