Fix #4475
Existing implementation would append the default value for a varargs parameter (the empty array) to the end of the sons of the nnkCall node, rather than storing it into the correct index. This left the location where it should have been stored set to its default value of nil, causing later code that uses this node to segfault.
This commit is contained in:
parent
9620e66533
commit
56015e52b9
1 changed files with 2 additions and 2 deletions
|
|
@ -1746,8 +1746,8 @@ proc matches*(c: PContext, n, nOrig: PNode, m: var TCandidate) =
|
||||||
if formal.ast == nil:
|
if formal.ast == nil:
|
||||||
if formal.typ.kind == tyVarargs:
|
if formal.typ.kind == tyVarargs:
|
||||||
var container = newNodeIT(nkBracket, n.info, arrayConstr(c, n.info))
|
var container = newNodeIT(nkBracket, n.info, arrayConstr(c, n.info))
|
||||||
addSon(m.call, implicitConv(nkHiddenStdConv, formal.typ,
|
setSon(m.call, formal.position + 1,
|
||||||
container, m, c))
|
implicitConv(nkHiddenStdConv, formal.typ, container, m, c))
|
||||||
else:
|
else:
|
||||||
# no default value
|
# no default value
|
||||||
m.state = csNoMatch
|
m.state = csNoMatch
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue