mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-17 16:38:33 +00:00
fixes #14805
This commit is contained in:
@@ -279,7 +279,7 @@ proc ccgIntroducedPtr(conf: ConfigRef; s: PSym, retType: PType): bool =
|
||||
result = false
|
||||
# first parameter and return type is 'lent T'? --> use pass by pointer
|
||||
if s.position == 0 and retType != nil and retType.kind == tyLent:
|
||||
result = true
|
||||
result = pt.kind != tyVar
|
||||
|
||||
proc fillResult(conf: ConfigRef; param: PNode) =
|
||||
fillLoc(param.sym.loc, locParam, param, ~"Result",
|
||||
|
||||
14
tests/lent/tlent_from_var.nim
Normal file
14
tests/lent/tlent_from_var.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
output: "x"
|
||||
"""
|
||||
|
||||
# bug #14805
|
||||
|
||||
type Foo = object
|
||||
a: string
|
||||
|
||||
proc bar(f: var Foo): lent string =
|
||||
result = f.a
|
||||
|
||||
var foo = Foo(a: "x")
|
||||
echo bar(foo)
|
||||
Reference in New Issue
Block a user