aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/use_after_reassign.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errors/use_after_reassign.zc')
-rw-r--r--tests/errors/use_after_reassign.zc10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/errors/use_after_reassign.zc b/tests/errors/use_after_reassign.zc
new file mode 100644
index 0000000..a295591
--- /dev/null
+++ b/tests/errors/use_after_reassign.zc
@@ -0,0 +1,10 @@
+namespace;
+include rt;
+
+// expect: r: used after it was given away; r borrows a, and a was freed by reassigning it on line 8 (a declared on line 6)
+fn main() {
+ let a = rt.new(4);
+ char* r = a + 1;
+ a = rt.new(4);
+ return r[0];
+}