Browse Source

* procvar and absolute probs
* procvar and addr() probs

peter 22 years ago
parent
commit
107c954939
3 changed files with 41 additions and 0 deletions
  1. 24 0
      tests/tbs/tb0433.pp
  2. 7 0
      tests/tbs/tb0434.pp
  3. 10 0
      tests/tbs/tb0435.pp

+ 24 - 0
tests/tbs/tb0433.pp

@@ -0,0 +1,24 @@
+{$ifdef FPC}
+{$mode Delphi}
+{$endif}
+{$APPTYPE CONSOLE}
+var
+ x:function(x:longint):longint;
+ y:pointer 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;
+end.

+ 7 - 0
tests/tbs/tb0434.pp

@@ -0,0 +1,7 @@
+var
+ x:function:longint;
+ y:pointer absolute x;
+begin
+  if y<>nil then
+   halt(1);
+end.

+ 10 - 0
tests/tbs/tb0435.pp

@@ -0,0 +1,10 @@
+
+{$ifdef fpc}{$mode Delphi}{$endif}
+
+var
+ x:function(x:longint):longint;
+ y:pointer absolute x;
+begin
+  if y<>nil then
+   halt(1);
+end.