aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/6-ownership/back_link_reasg.zc
diff options
context:
space:
mode:
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