summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-ret.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/regions/regions-ret.rs')
-rw-r--r--tests/ui/regions/regions-ret.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ui/regions/regions-ret.rs b/tests/ui/regions/regions-ret.rs
new file mode 100644
index 000000000..580545ef8
--- /dev/null
+++ b/tests/ui/regions/regions-ret.rs
@@ -0,0 +1,8 @@
+fn id<T>(x: T) -> T { x }
+
+fn f(_x: &isize) -> &isize {
+ return &id(3); //~ ERROR cannot return reference to temporary value
+}
+
+fn main() {
+}