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