summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorJuan M Gómez <info@jmgomez.me>2024-08-18 12:21:17 +0100
committerGitHub <noreply@github.com>2024-08-18 13:21:17 +0200
commit2e4d344b43b040a4dce2c478ca13e49979e491fc (patch)
treec6955db79990e79696e0b1d05311872d6d280489 /compiler
parentf7c11a8978a1fc7182ef18c4bdc80e920ce6ad88 (diff)
downloadNim-2e4d344b43b040a4dce2c478ca13e49979e491fc.tar.gz
Fixes #23962 `resetLoc`doenst produce any cgen code in `importcpp` types (#23964)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgen.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 95155bb20..7291602f4 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -482,7 +482,10 @@ include ccgreset
 proc resetLoc(p: BProc, loc: var TLoc) =
   let containsGcRef = optSeqDestructors notin p.config.globalOptions and containsGarbageCollectedRef(loc.t)
   let typ = skipTypes(loc.t, abstractVarRange)
-  if isImportedCppType(typ): return
+  if isImportedCppType(typ): 
+    var didGenTemp = false
+    linefmt(p, cpsStmts, "$1 = $2;$n", [rdLoc(loc), genCppInitializer(p.module, p, typ, didGenTemp)])
+    return
   if optSeqDestructors in p.config.globalOptions and typ.kind in {tyString, tySequence}:
     assert loc.snippet != ""