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