aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/use_after_free_owner.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 09:48:10 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 09:48:10 +0330
commit0a87c4663fc52bf60f3d440200b3b3ad6b39bd3e (patch)
tree40d88acb972080ed90d89c7a866247263c252cae /tests/errors/use_after_free_owner.zc
parentmerge work/stdio: std.Io and one-level module completion (diff)
analyzer: use-after-end messages name the borrower, the owner and how the owner ended (freed, moved, .d parameter, push, global, reassignment), with fixtures
Diffstat (limited to 'tests/errors/use_after_free_owner.zc')
-rw-r--r--tests/errors/use_after_free_owner.zc9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/errors/use_after_free_owner.zc b/tests/errors/use_after_free_owner.zc
new file mode 100644
index 0000000..e530bf5
--- /dev/null
+++ b/tests/errors/use_after_free_owner.zc
@@ -0,0 +1,9 @@
+namespace;
+include rt;
+
+// expect: t: used after it was given away; t was freed on line 7 (declared on line 6)
+fn main() {
+ let t = rt.new(4);
+ rt.free(t);
+ return t[0];
+}