aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/3-expressions
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 16:35:53 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 16:35:53 +0330
commit6cca028ab8d2f87e7005b8760afde0a8a71a023b (patch)
tree6bf1aa84621374d0ba0bf95a12e0097aeb326688 /tests/conformance/3-expressions
parentmerge bounds checking (diff)
parenttodo: zc0 gaps done (diff)
merge work/xref: zc0 gaps a-f
Diffstat (limited to 'tests/conformance/3-expressions')
-rw-r--r--tests/conformance/3-expressions/cast_as_pointer_type.zc15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/conformance/3-expressions/cast_as_pointer_type.zc b/tests/conformance/3-expressions/cast_as_pointer_type.zc
new file mode 100644
index 0000000..5ebc696
--- /dev/null
+++ b/tests/conformance/3-expressions/cast_as_pointer_type.zc
@@ -0,0 +1,15 @@
+// expect: 4/5/1/
+// spec: the type after `as` is a whole type, stars included (zc0 used to read one name)
+include rt;
+void pn(int x) { rt.put_n(x); rt.put_c(10); }
+int[3] a;
+fn main() {
+ a[1] = 4; a[2] = 5;
+ word w = a;
+ int* q = w as int*;
+ char** r = 0 as char**;
+ pn((q as int*)[1]);
+ pn(q[2]);
+ pn(r == 0);
+ return 0;
+}