From 8703e2c85a8ecdea9e869e876e347ebd4cb6ef88 Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 14:59:31 +0330 Subject: analyzer: a back link (container's owner stored into it) stays a plain reference, fixing a compile hang on a<->b and a leak; ending an owner kills its owned children too (fixes use after reassigning a container); escape fixtures --- tests/conformance/6-ownership/back_link_alias.zc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/conformance/6-ownership/back_link_alias.zc (limited to 'tests/conformance/6-ownership/back_link_alias.zc') diff --git a/tests/conformance/6-ownership/back_link_alias.zc b/tests/conformance/6-ownership/back_link_alias.zc new file mode 100644 index 0000000..58db710 --- /dev/null +++ b/tests/conformance/6-ownership/back_link_alias.zc @@ -0,0 +1,6 @@ +// expect error: b: is an owned object and can't be copied into another variable +// spec 6.6 +include rt; +struct node { int value; node* prev; node* next; }; +fn main() { node* p; { node* a = rt.new(node); node* b = rt.new(node); a.next = b; b.prev = a; p = b; } rt.put_n(p.prev.value); } +// zc0: skip -- cgit v1.2.3