summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorheterodoxic <122719743+heterodoxic@users.noreply.github.com>2023-05-19 21:24:37 +0200
committerGitHub <noreply@github.com>2023-05-19 21:24:37 +0200
commit476e0320048f82c2743ca96614fde87b69ef2559 (patch)
treeafab067adb42decf1bada2c0f0772981aa84b538
parent4186529ff7ae9afcdf56ceed41da43e806e537e1 (diff)
downloadNim-476e0320048f82c2743ca96614fde87b69ef2559.tar.gz
potential fix for C++ codegen with ARC/ORC and goto exceptions fixes #21579, fixes #21862 (#21868)
potential fix for C++ codegen with ARC/ORC and goto exceptions
-rw-r--r--compiler/ccgstmts.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index 6ce632a2a..315af8777 100644
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -329,7 +329,8 @@ proc genSingleVar(p: BProc, v: PSym; vn, value: PNode) =
   else:
     let imm = isAssignedImmediately(p.config, value)
     if imm and p.module.compileToCpp and p.splitDecls == 0 and
-        not containsHiddenPointer(v.typ):
+        not containsHiddenPointer(v.typ) and
+        nimErrorFlagAccessed notin p.flags:
       # C++ really doesn't like things like 'Foo f; f = x' as that invokes a
       # parameterless constructor followed by an assignment operator. So we
       # generate better code here: 'Foo f = x;'