fixes #6118
This commit is contained in:
parent
ed5888ba30
commit
ad2ef0f70a
1 changed files with 6 additions and 4 deletions
|
|
@ -2123,17 +2123,19 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
|
||||||
# See tests/run/tcnstseq3 for an example that would fail otherwise.
|
# See tests/run/tcnstseq3 for an example that would fail otherwise.
|
||||||
genAsgn(p, n, fastAsgn=p.prc != nil)
|
genAsgn(p, n, fastAsgn=p.prc != nil)
|
||||||
of nkDiscardStmt:
|
of nkDiscardStmt:
|
||||||
if n.sons[0].kind != nkEmpty:
|
let ex = n[0]
|
||||||
|
if ex.kind != nkEmpty:
|
||||||
genLineDir(p, n)
|
genLineDir(p, n)
|
||||||
var a: TLoc
|
var a: TLoc
|
||||||
if n[0].kind in nkCallKinds:
|
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:
|
# bug #6037: do not assign to a temp in C++ mode:
|
||||||
incl a.flags, lfSingleUse
|
incl a.flags, lfSingleUse
|
||||||
genCall(p, n[0], a)
|
genCall(p, ex, a)
|
||||||
if lfSingleUse notin a.flags:
|
if lfSingleUse notin a.flags:
|
||||||
line(p, cpsStmts, a.r & ";" & tnl)
|
line(p, cpsStmts, a.r & ";" & tnl)
|
||||||
else:
|
else:
|
||||||
initLocExpr(p, n.sons[0], a)
|
initLocExpr(p, ex, a)
|
||||||
of nkAsmStmt: genAsmStmt(p, n)
|
of nkAsmStmt: genAsmStmt(p, n)
|
||||||
of nkTryStmt:
|
of nkTryStmt:
|
||||||
if p.module.compileToCpp and optNoCppExceptions notin gGlobalOptions:
|
if p.module.compileToCpp and optNoCppExceptions notin gGlobalOptions:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue