diff options
author | Juan M Gómez <info@jmgomez.me> | 2024-03-21 07:48:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 08:48:14 +0100 |
commit | 33902d9dbb65fbfdfbd6e3b2a34c6e19eccb762f (patch) | |
tree | 933b843969ccaa492030f16e0b3389dd0ac3e303 /compiler | |
parent | 50c1e93a7481a79634b5d444806c94c1ea12b8ff (diff) | |
download | Nim-33902d9dbb65fbfdfbd6e3b2a34c6e19eccb762f.tar.gz |
[Cpp] Fixes an issue when mixing hooks and calls (#23428)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgstmts.nim | 5 | ||||
-rw-r--r-- | compiler/cgen.nim | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index fb8c89650..345639d94 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -369,7 +369,10 @@ proc genSingleVar(p: BProc, v: PSym; vn, value: PNode) = line(p, cpsStmts, decl) else: tmp = initLocExprSingleUse(p, value) - lineF(p, cpsStmts, "$# = $#;\n", [decl, tmp.rdLoc]) + if value.kind == nkEmpty: + lineF(p, cpsStmts, "$#;\n", [decl]) + else: + lineF(p, cpsStmts, "$# = $#;\n", [decl, tmp.rdLoc]) return assignLocalVar(p, vn) initLocalVar(p, v, imm) diff --git a/compiler/cgen.nim b/compiler/cgen.nim index ca735166a..a705332fd 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -1208,6 +1208,7 @@ proc genProcAux*(m: BModule, prc: PSym) = elif sfConstructor in prc.flags: resNode.sym.loc.flags.incl lfIndirect fillLoc(resNode.sym.loc, locParam, resNode, "this", OnHeap) + prc.loc.r = getTypeDesc(m, resNode.sym.loc.t, dkVar) else: fillResult(p.config, resNode, prc.typ) assignParam(p, res, prc.typ.returnType) |