aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/6-ownership/back_link_reasg.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 17:50:10 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 17:50:10 +0330
commit251b0212f626d0f92eda51906d353712ef4a63b8 (patch)
tree4f0e0b0ee6b0f6d0671261a46bb2bcd15ef0f59c /tests/conformance/6-ownership/back_link_reasg.zc
parentmerge work/actors: wasm seed bootstrap (seed/MANIFEST), shared copy-on-write ... (diff)
parentprescan: guess an owned return only from a local declared from new/heap, not ... (diff)
merge work/demo-fixes: analyzer ownership fixes (back links, loop-built lists, .u inference), Io.print any args, block-end borrow messages
Diffstat (limited to 'tests/conformance/6-ownership/back_link_reasg.zc')
-rw-r--r--tests/conformance/6-ownership/back_link_reasg.zc6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/conformance/6-ownership/back_link_reasg.zc b/tests/conformance/6-ownership/back_link_reasg.zc
new file mode 100644
index 0000000..02709a8
--- /dev/null
+++ b/tests/conformance/6-ownership/back_link_reasg.zc
@@ -0,0 +1,6 @@
+// expect error: b: used after it was given away; b borrows a, and a was freed by reassigning it
+// spec 6.6
+include rt;
+struct node { int value; node* prev; node* next; };
+fn main() { node* a = rt.new(node); node* b = rt.new(node); a.next = b; b.prev = a; a = rt.new(node); a.value = 1; rt.put_n(b.prev.value); }
+// zc0: skip