aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/zc0unbounded.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/programs/zc0unbounded.zc')
-rw-r--r--tests/programs/zc0unbounded.zc16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/programs/zc0unbounded.zc b/tests/programs/zc0unbounded.zc
new file mode 100644
index 0000000..67c3ae0
--- /dev/null
+++ b/tests/programs/zc0unbounded.zc
@@ -0,0 +1,16 @@
+namespace;
+include rt;
+
+// unbounded in all three places zc0 accepts it (and ignores): the unit, a
+// function prefix and a statement. both compilers print the same.
+unbounded;
+int[4] a;
+unbounded int get(int i) { return a[i]; }
+int main() {
+ int i = 2, r = 0;
+ a[2] = 40;
+ unbounded r = get(i) + 2;
+ unbounded { r = r + a[i - 2]; }
+ rt.put_n(r); rt.put_c(10);
+ return 0;
+}