mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes #4910
This commit is contained in:
@@ -1296,10 +1296,13 @@ proc takeImplicitAddr(c: PContext, n: PNode): PNode =
|
||||
proc asgnToResultVar(c: PContext, n, le, ri: PNode) {.inline.} =
|
||||
if le.kind == nkHiddenDeref:
|
||||
var x = le.sons[0]
|
||||
if x.typ.kind == tyVar and x.kind == nkSym and x.sym.kind == skResult:
|
||||
n.sons[0] = x # 'result[]' --> 'result'
|
||||
n.sons[1] = takeImplicitAddr(c, ri)
|
||||
x.typ.flags.incl tfVarIsPtr
|
||||
if x.typ.kind == tyVar and x.kind == nkSym:
|
||||
if x.sym.kind == skResult:
|
||||
n.sons[0] = x # 'result[]' --> 'result'
|
||||
n.sons[1] = takeImplicitAddr(c, ri)
|
||||
if x.sym.kind != skParam:
|
||||
# XXX This is hacky. See bug #4910.
|
||||
x.typ.flags.incl tfVarIsPtr
|
||||
#echo x.info, " setting it for this type ", typeToString(x.typ), " ", n.info
|
||||
|
||||
template resultTypeIsInferrable(typ: PType): untyped =
|
||||
|
||||
@@ -21,3 +21,11 @@ proc getSubsystem*[T](): ptr T {.
|
||||
|
||||
let input: ptr Input = getSubsystem[Input]()
|
||||
|
||||
|
||||
# bug #4910
|
||||
|
||||
proc foo() =
|
||||
var ts: array[10, int]
|
||||
for t in mitems(ts):
|
||||
t = 123
|
||||
|
||||
|
||||
Reference in New Issue
Block a user