diff options
author | Araq <rumpf_a@web.de> | 2020-03-10 11:10:52 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-03-11 09:26:57 +0100 |
commit | 60f8fdcdabf99ae60f7a743cfd682bd7c320408b (patch) | |
tree | af457daf9cf81c08b550b38654fbc6d422fbc5bb /compiler/ccgexprs.nim | |
parent | 861a5340fec22cbca014bffc84f61536a5aa3e37 (diff) | |
download | Nim-60f8fdcdabf99ae60f7a743cfd682bd7c320408b.tar.gz |
fixes #13240
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r-- | compiler/ccgexprs.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index f133b97a2..1bed4bc6c 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1340,7 +1340,14 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = #echo rendertree e, " ", e.isDeepConstExpr # inheritance in C++ does not allow struct initialization so # we skip this step here: - if not p.module.compileToCpp: + if not p.module.compileToCpp and optSeqDestructors notin p.config.globalOptions: + # disabled optimization: it is wrong for C++ and now also + # causes trouble for --gc:arc, see bug #13240 + #[ + var box: seq[Thing] + for i in 0..3: + box.add Thing(s1: "121") # pass by sink can mutate Thing. + ]# if handleConstExpr(p, e, d): return var t = e.typ.skipTypes(abstractInstOwned) let isRef = t.kind == tyRef |