diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-10-13 16:58:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-13 10:58:43 +0200 |
commit | 61145b1d4bd60712dbaeaca19d01f3696546046c (patch) | |
tree | a6c881476b8d9c489ab14f4e4b2687293df092c3 /compiler | |
parent | 8990626ca9715a3687b28331aee4ccf242997aa2 (diff) | |
download | Nim-61145b1d4bd60712dbaeaca19d01f3696546046c.tar.gz |
fixes #22354; Wrong C++ codegen for default parameter values in ORC (#22819)
fixes #22354 It skips `nkHiddenAddr`. No need to hoist `var parameters` without side effects. Besides, it saves lots of temporary variables in ORC.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 8cdd16f02..e6983910d 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -2927,7 +2927,7 @@ proc hoistParamsUsedInDefault(c: PContext, call, letSection, defExpr: var PNode) if defExpr.kind == nkSym and defExpr.sym.kind == skParam and defExpr.sym.owner == call[0].sym: let paramPos = defExpr.sym.position + 1 - if call[paramPos].kind != nkSym: + if call[paramPos].skipAddr.kind != nkSym: let hoistedVarSym = newSym(skLet, getIdent(c.graph.cache, genPrefix), c.idgen, c.p.owner, letSection.info, c.p.owner.options) hoistedVarSym.typ = call[paramPos].typ @@ -2939,7 +2939,7 @@ proc hoistParamsUsedInDefault(c: PContext, call, letSection, defExpr: var PNode) call[paramPos] = newSymNode(hoistedVarSym) # Refer the original arg to its hoisted sym - # arg we refer to is a sym, wether introduced by hoisting or not doesn't matter, we simply reuse it + # arg we refer to is a sym, whether introduced by hoisting or not doesn't matter, we simply reuse it defExpr = call[paramPos] else: for i in 0..<defExpr.safeLen: |