aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/temporary_retained.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errors/temporary_retained.zc')
-rw-r--r--tests/errors/temporary_retained.zc8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/errors/temporary_retained.zc b/tests/errors/temporary_retained.zc
new file mode 100644
index 0000000..3251a65
--- /dev/null
+++ b/tests/errors/temporary_retained.zc
@@ -0,0 +1,8 @@
+namespace;
+include rt;
+
+// expect: a temporary argument requires a proved non-escaping borrow
+char* retained;
+char*.u message() { return rt.new(2); }
+fn store(char* p) { let alias = p; retained = alias; }
+fn main() { store(message()); }