Fixes discard bug in cpp codegen (#9747) [backport]
Fixes discard bug in cpp codegen
This commit is contained in:
parent
ebcf9406be
commit
9b9f5dee0b
2 changed files with 13 additions and 10 deletions
|
|
@ -2441,15 +2441,8 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
|
|||
if ex.kind != nkEmpty:
|
||||
genLineDir(p, n)
|
||||
var a: TLoc
|
||||
if ex.kind in nkCallKinds and (ex[0].kind != nkSym or
|
||||
ex[0].sym.magic == mNone):
|
||||
# bug #6037: do not assign to a temp in C++ mode:
|
||||
incl a.flags, lfSingleUse
|
||||
genCall(p, ex, a)
|
||||
if lfSingleUse notin a.flags:
|
||||
line(p, cpsStmts, a.r & ";\L")
|
||||
else:
|
||||
initLocExpr(p, ex, a)
|
||||
initLocExprSingleUse(p, ex, a)
|
||||
line(p, cpsStmts, "(void)(" & a.r & ");\L")
|
||||
of nkAsmStmt: genAsmStmt(p, n)
|
||||
of nkTryStmt:
|
||||
if p.module.compileToCpp and optNoCppExceptions notin p.config.globalOptions:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue