fpc/tests/test/tblock3a.pp
Jonas Maebe eeb8c747d5 --- Merging r42499 into '.':
U    packages/univint/fpmake.pp
...
--- Recording mergeinfo for merge of r42499 into '.':
 U   .
--- Merging r42500 into '.':
U    packages/cocoaint/fpmake.pp
...
--- Recording mergeinfo for merge of r42500 into '.':
 G   .
--- Merging r42548 into '.':
G    packages/univint/src/AUComponent.pas
G    packages/univint/src/AudioUnitProperties.pas
--- Recording mergeinfo for merge of r42548 into '.':
 G   .
--- Merging r43684 into '.':
U    compiler/msg/errore.msg
...
--- Recording mergeinfo for merge of r43684 into '.':
 G   .
--- Merging r43687 into '.':
G    packages/univint/src/AudioComponents.pas
U    packages/univint/src/AudioServices.pas
--- Recording mergeinfo for merge of r43687 into '.':
 G   .

git-svn-id: branches/fixes_3_2@44035 -
2020-01-26 12:48:42 +00:00

76 lines
1.1 KiB
ObjectPascal

{ %target=darwin,iphonesim}
{ %skipcpu=powerpc,powerpc64 }
program tblock3a;
{$mode objfpc}
{$modeswitch cblocks}
type
{$calling cdecl}
tblock1 = reference to procedure(j: longint); cblock;
{$calling mwpascal}
tblock2 = reference to procedure(j : longint); cblock;
tc = class
i: longint;
procedure callme(j: longint);
end;
var
b1: tblock1;
b2: tblock2;
c: tc;
procedure tc.callme(j: longint);
const
invocationcount: longint = 0;
begin
writeln('self: ',hexstr(pointer(self)),', i: ',i,', j: ',j);
if self<>c then
halt(1);
if i<>12345 then
halt(2);
case invocationcount of
0:
if j<>1 then
halt(3);
1, 2:
if j<>2 then
halt(4);
3:
if j<>3 then
halt(5);
4, 5:
if j<>4 then
halt(6);
end;
inc(invocationcount);
end;
procedure test1(b: tblock1);
begin
b1(2);
end;
procedure test2(b: tblock2);
begin
b2(4);
end;
begin
c:=tc.create;
c.i:=12345;
b1:=@c.callme;
b1(1);
test1(@c.callme);
test1(b1);
b2:=@c.callme;
b2(3);
test2(@c.callme);
test2(b2);
end.