mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 03:44:14 +00:00
fixes #24034
This commit is contained in:
@@ -1879,6 +1879,8 @@ proc takeImplicitAddr(c: PContext, n: PNode; isLent: bool): PNode =
|
||||
else:
|
||||
localError(c.config, n.info, errExprHasNoAddress)
|
||||
result = newNodeIT(nkHiddenAddr, n.info, if n.typ.kind in {tyVar, tyLent}: n.typ else: makePtrType(c, n.typ))
|
||||
if n.typ.kind in {tyVar, tyLent}:
|
||||
n.typ = n.typ.elementType
|
||||
result.add(n)
|
||||
|
||||
proc asgnToResultVar(c: PContext, n, le, ri: PNode) {.inline.} =
|
||||
|
||||
@@ -86,3 +86,22 @@ block: # bug #23454
|
||||
for (a, _) in instance:
|
||||
case a
|
||||
of A: discard
|
||||
|
||||
block: # bug #24034
|
||||
type T = object
|
||||
v: array[100, byte]
|
||||
|
||||
|
||||
iterator pairs(t: T): (int, lent array[100, byte]) =
|
||||
yield (0, t.v)
|
||||
|
||||
|
||||
block:
|
||||
for a, b in default(T):
|
||||
doAssert a == 0
|
||||
doAssert b.len == 100
|
||||
|
||||
block:
|
||||
for (a, b) in pairs(default(T)):
|
||||
doAssert a == 0
|
||||
doAssert b.len == 100
|
||||
|
||||
Reference in New Issue
Block a user