diff options
author | Araq <rumpf_a@web.de> | 2020-07-08 10:51:26 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-07-08 12:22:55 +0200 |
commit | cb1ecbf95620bffd559610b70f99c6f16963ac5c (patch) | |
tree | a472c96179ed6816d680190b16731afb76d316e1 /tests | |
parent | e42ce877a6469ccc6eb99e1e0f6162aeb6839193 (diff) | |
download | Nim-cb1ecbf95620bffd559610b70f99c6f16963ac5c.tar.gz |
closes #14878
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lent/tlent_from_var.nim | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/lent/tlent_from_var.nim b/tests/lent/tlent_from_var.nim index c8a15b1a1..912390dc1 100644 --- a/tests/lent/tlent_from_var.nim +++ b/tests/lent/tlent_from_var.nim @@ -1,5 +1,6 @@ discard """ - output: "x" + output: '''x +[10, 11, 12, 13]''' """ # bug #14805 @@ -12,3 +13,20 @@ proc bar(f: var Foo): lent string = var foo = Foo(a: "x") echo bar(foo) + + +# bug #14878 + +# proc byLentImpl[T](a: T): lent T = a +proc byLentVar[T](a: var T): lent T = + result = a + # result = a.byLentImpl # this doesn't help + +var x = 3 # error: cannot take the address of an rvalue of type 'NI *' + +var xs = [10,11,12,13] # SIGSEGV + +let x2 = x.byLentVar + +let xs2 = xs.byLentVar +echo xs2 |