mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-08 04:44:20 +00:00
closes #14878
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user