summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-27 10:20:32 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-27 10:20:40 +0000
commit08247ead8ecd05d892b98bfb12ed807bcfebfc5c (patch)
treede10d620840075c96aa7fdcbc2bda6745ca22877 /tests
parent86ae08ff28ee47c57546c487b0bdaab27c4ab5ad (diff)
Fix zero init bug
Diffstat (limited to 'tests')
-rw-r--r--tests/features/test_zero_init.zc27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/features/test_zero_init.zc b/tests/features/test_zero_init.zc
new file mode 100644
index 0000000..ba5c209
--- /dev/null
+++ b/tests/features/test_zero_init.zc
@@ -0,0 +1,27 @@
+
+def SIZE = 5;
+
+struct Point {
+ x: int;
+ y: int;
+}
+
+fn main() {
+ let zeros: [int; SIZE];
+
+ if (zeros[0] != 0) return 1;
+ if (zeros[1] != 0) return 1;
+ if (zeros[2] != 0) return 1;
+ if (zeros[3] != 0) return 1;
+ if (zeros[4] != 0) return 1;
+
+ let p: Point;
+ if (p.x != 0) return 2;
+ if (p.y != 0) return 2;
+
+ let b: bool;
+ if (b) { return 3; }
+
+ println "SUCCESS";
+ return 0;
+}