fixes #5517
This commit is contained in:
parent
ad64b66df1
commit
d9d61fbeb4
2 changed files with 17 additions and 0 deletions
|
|
@ -939,6 +939,8 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) =
|
||||||
if y.kind == nkCall:
|
if y.kind == nkCall:
|
||||||
let tmp = p.getTemp(false)
|
let tmp = p.getTemp(false)
|
||||||
lineF(p, "var $1 = $4; $2 = $1[0]; $3 = $1[1];$n", [tmp, a.address, a.res, b.rdLoc])
|
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:
|
else:
|
||||||
internalError(x.info, "genAsgn")
|
internalError(x.info, "genAsgn")
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -52,3 +52,18 @@ input.add(nil)
|
||||||
input.add(new string)
|
input.add(new string)
|
||||||
input[1][] = "~"
|
input[1][] = "~"
|
||||||
echo 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: ...)")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue