fpc/tests/tbs/tb0433.pp
2020-08-16 10:48:10 +00:00

42 lines
602 B
ObjectPascal

{$ifdef fpc}
{$mode tp}
{$else fpc}
type
codepointer = pointer;
{$endif fpc}
{$F+}
function times2(x : longint) : longint;
begin
times2:=2*x;
end;
var
x:function(x:longint):longint;
y:codepointer absolute x;
z,w,v:pointer;
begin
z:=@@x;
w:=addr(@x);
v:=@(addr(x));
writeln(longint(y),' ',longint(z),' ',longint(w),' ',longint(v));
if (z<>w) or (z<>v) then
begin
writeln('Addr Error');
halt(1);
end;
if (y<>nil) then
begin
writeln('Absolute Error');
halt(1);
end;
x:=times2;
if (y<>@times2) then
begin
writeln('Absolute Error');
halt(1);
end;
end.