This commit is contained in:
Andreas Rumpf
2017-06-30 00:43:19 +02:00
parent ad64b66df1
commit d9d61fbeb4
2 changed files with 17 additions and 0 deletions

View File

@@ -939,6 +939,8 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) =
if y.kind == nkCall:
let tmp = p.getTemp(false)
lineF(p, "var $1 = $4; $2 = $1[0]; $3 = $1[1];$n", [tmp, a.address, a.res, b.rdLoc])
elif b.typ == etyBaseIndex:
lineF(p, "$# = $#;$n", [a.res, b.rdLoc])
else:
internalError(x.info, "genAsgn")
else:

View File

@@ -52,3 +52,18 @@ input.add(nil)
input.add(new string)
input[1][] = "~"
echo input[1][]
# bug #5517
type
TypeA1 = object of RootObj
a_impl: int
b_impl: string
c_impl: pointer
proc initTypeA1(a: int; b: string; c: pointer = nil): TypeA1 =
result.a_impl = a
result.b_impl = b
result.c_impl = c
let x = initTypeA1(1, "a")
doAssert($x == "(a_impl: 1, b_impl: a, c_impl: ...)")