summary refs log tree commit diff stats
path: root/compiler/ccgstmts.nim
diff options
context:
space:
mode:
authorJuan M Gómez <info@jmgomez.me>2024-03-21 07:48:14 +0000
committerGitHub <noreply@github.com>2024-03-21 08:48:14 +0100
commit33902d9dbb65fbfdfbd6e3b2a34c6e19eccb762f (patch)
tree933b843969ccaa492030f16e0b3389dd0ac3e303 /compiler/ccgstmts.nim
parent50c1e93a7481a79634b5d444806c94c1ea12b8ff (diff)
downloadNim-33902d9dbb65fbfdfbd6e3b2a34c6e19eccb762f.tar.gz
[Cpp] Fixes an issue when mixing hooks and calls (#23428)
Diffstat (limited to 'compiler/ccgstmts.nim')
-rw-r--r--compiler/ccgstmts.nim5
1 files changed, 4 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)