This commit is contained in:
Andreas Rumpf 2016-08-04 21:44:06 +02:00
commit 7ea318a053
3 changed files with 27 additions and 6 deletions

View file

@ -328,7 +328,8 @@ proc initLocalVar(p: BProc, v: PSym, immediateAsgn: bool) =
proc getTemp(p: BProc, t: PType, result: var TLoc; needsInit=false) = proc getTemp(p: BProc, t: PType, result: var TLoc; needsInit=false) =
inc(p.labels) inc(p.labels)
result.r = "LOC" & rope(p.labels) result.r = "LOC" & rope(p.labels)
linefmt(p, cpsLocals, "$1 $2;$n", getTypeDesc(p.module, t), result.r) addf(p.blocks[0].sections[cpsLocals],
"$1 $2;$n", [getTypeDesc(p.module, t), result.r])
result.k = locTemp result.k = locTemp
#result.a = - 1 #result.a = - 1
result.t = t result.t = t

View file

@ -0,0 +1,20 @@
# bug #4505
proc f(t: tuple[]) = discard
f((block: ()))
# bug #4230
# If we make `test` function return nothing - the bug disappears
proc test(dothejob: proc()): int {.discardable.} =
dothejob()
test proc() =
let f = 15
if f > 10:
test proc() = discard
# If we remove elif branch of the condition - the bug disappears
elif f < 3:
test proc() = discard
else:
test proc() = discard