mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-08 14:03:23 +00:00
fixes a C code generator regression, no need to backport, only the 1.4 line is affected (#15569)
This commit is contained in:
@@ -249,7 +249,7 @@ proc openArrayLoc(p: BProc, formalType: PType, n: PNode): Rope =
|
||||
else: internalError(p.config, "openArrayLoc: " & typeToString(a.t))
|
||||
|
||||
proc withTmpIfNeeded(p: BProc, a: TLoc, needsTmp: bool): TLoc =
|
||||
if needsTmp:
|
||||
if needsTmp and a.lode.typ != nil:
|
||||
var tmp: TLoc
|
||||
getTemp(p, a.lode.typ, tmp, needsInit=false)
|
||||
genAssignment(p, tmp, a, {})
|
||||
|
||||
18
tests/ccgbugs/t2procs.nim
Normal file
18
tests/ccgbugs/t2procs.nim
Normal file
@@ -0,0 +1,18 @@
|
||||
discard """
|
||||
output: '''before
|
||||
1
|
||||
before
|
||||
2'''
|
||||
"""
|
||||
|
||||
proc fn[T1, T2](a: T1, b: T2) =
|
||||
a(1)
|
||||
b(2)
|
||||
|
||||
fn( (proc(x: int) =
|
||||
echo "before" # example block, can span multiple lines
|
||||
echo x),
|
||||
(proc (y: int) =
|
||||
echo "before"
|
||||
echo y)
|
||||
)
|
||||
Reference in New Issue
Block a user