Browse Source

+ test that the compiler should not allow non local goto

olle 21 years ago
parent
commit
aa9fbc040e
1 changed files with 27 additions and 0 deletions
  1. 27 0
      tests/tbf/tb0164.pp

+ 27 - 0
tests/tbf/tb0164.pp

@@ -0,0 +1,27 @@
+{ %fail }
+
+program tb0164;
+
+{ Non local goto cannot be handled properly by the compiler,
+  and should therefore not be allowed.}
+
+{$GOTO ON}
+
+  procedure foo;
+  
+    label 999;
+  
+    procedure bar;
+  
+    begin
+      goto 999
+    end;
+  
+  begin
+    bar;
+    999:
+  end;
+  
+begin
+  foo;
+end.