aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/uninit_loop.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errors/uninit_loop.zc')
-rw-r--r--tests/errors/uninit_loop.zc11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/errors/uninit_loop.zc b/tests/errors/uninit_loop.zc
new file mode 100644
index 0000000..d345296
--- /dev/null
+++ b/tests/errors/uninit_loop.zc
@@ -0,0 +1,11 @@
+namespace;
+include rt;
+
+// expect: x: used before it is initialized
+fn main() {
+ int x;
+ int n = 0;
+ while (n) { x = 1; n = 0; }
+ rt.put_n(x);
+ return 0;
+}