mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 04:09:15 +02:00
* methodpointer 2 procvar test
This commit is contained in:
parent
215880afe8
commit
0653404f70
29
tests/tbf/tb0154.pp
Normal file
29
tests/tbf/tb0154.pp
Normal file
@ -0,0 +1,29 @@
|
||||
{ %fail }
|
||||
|
||||
{$mode objfpc}
|
||||
type
|
||||
tc = class
|
||||
left,right: tc;
|
||||
function test(var c: tc): boolean;
|
||||
end;
|
||||
|
||||
testfunc = function(var c: tc):boolean;
|
||||
|
||||
function foreach(var c: tc; p: testfunc): boolean;
|
||||
begin
|
||||
if not assigned(c) then
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
function tc.test(var c: tc): boolean;
|
||||
begin
|
||||
{ The @tc.test is still a pointer to a method and not valid
|
||||
with a normal procvar }
|
||||
result := foreach(c.left,@tc.test);
|
||||
result := foreach(c.right,@tc.test) or result;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user