Files
Nim/tests/arc/t24806.nim
ringabout 73aeac81d1 fixes #24806; don't elide wasMoved when syms are used in blocks (#24831)
fixes #24806

Blocks don't merge symbols that are used before destruction to the
parent scope, which causes `wasMoved; destroy` to elide incorrectly
2025-04-03 12:54:00 +02:00

40 lines
558 B
Nim

discard """
matrix: "-d:useMalloc;"
"""
type
GlobFilter* = object
incl*: bool
glob*: string
GlobState* = object
one: int
two: int
proc aa() =
let filters = @[GlobFilter(incl: true, glob: "**")]
var wbg = newSeqOfCap[GlobState](1)
wbg.add GlobState()
var
dirc = @[wbg]
while true:
wbg = dirc[^1]
dirc.add wbg
break
var handlerLocs = newSeq[string]()
handlerLocs.add "sammich"
aa()
aa()
block: # bug #24806
proc aa() =
var
a = @[0]
b = @[a]
block:
a = b[0]
b.add a
aa()