瀏覽代碼

+ test that the compiler should not allow non local goto

olle 21 年之前
父節點
當前提交
aa9fbc040e
共有 1 個文件被更改,包括 27 次插入0 次删除
  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.