aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/6-ownership/outer_owner_in_inner_container.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 14:57:42 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 14:57:42 +0330
commit0432ac6aefccbc5a9af25bd4ed2d4451611c4ff4 (patch)
treeba312d92bc223e1a4c500134cf1343f7e1f63180 /tests/conformance/6-ownership/outer_owner_in_inner_container.zc
parentmerge work/borrow: borrow returns before definition, borrows clause, borrow m... (diff)
analyzer: an outer owner moved into a deeper container can take it back (loop-built lists); block-end frees name the owner (why 9) in messages and LSP related info
Diffstat (limited to 'tests/conformance/6-ownership/outer_owner_in_inner_container.zc')
-rw-r--r--tests/conformance/6-ownership/outer_owner_in_inner_container.zc13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/conformance/6-ownership/outer_owner_in_inner_container.zc b/tests/conformance/6-ownership/outer_owner_in_inner_container.zc
new file mode 100644
index 0000000..d9043c0
--- /dev/null
+++ b/tests/conformance/6-ownership/outer_owner_in_inner_container.zc
@@ -0,0 +1,13 @@
+// expect error: head: belongs to item, which was freed at the end of its block (line 10)
+// spec 6.8.5
+include rt;
+struct node { int value; node* next; };
+fn main() {
+ node* head = rt.new(node);
+ {
+ node* item = rt.new(node);
+ item.next = head;
+ }
+ rt.put_n(head.value);
+}
+// zc0: skip