mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 14:23:45 +00:00
fixes #24806 Blocks don't merge symbols that are used before destruction to the parent scope, which causes `wasMoved; destroy` to elide incorrectly
40 lines
558 B
Nim
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()
|