aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/reassign_from_own_child.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errors/reassign_from_own_child.zc')
-rw-r--r--tests/errors/reassign_from_own_child.zc6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/errors/reassign_from_own_child.zc b/tests/errors/reassign_from_own_child.zc
new file mode 100644
index 0000000..4a23e51
--- /dev/null
+++ b/tests/errors/reassign_from_own_child.zc
@@ -0,0 +1,6 @@
+namespace;
+include rt;
+
+struct node { node* next; int v; }
+// expect: a: reassigning frees the old value, and the new value is part of it
+fn main() { node* a = rt.new(node); a.next = rt.new(node); a = a.next; return 0; }