fixes #22058; invalid free with {.noSideEffect.} in template (#22088)

This commit is contained in:
ringabout
2023-06-13 18:03:20 +08:00
committed by GitHub
parent 5679f2b84c
commit 2e12d3e26b
2 changed files with 35 additions and 20 deletions

16
tests/arc/tmalloc.nim Normal file
View File

@@ -0,0 +1,16 @@
discard """
matrix: "--mm:arc -d:useMalloc; --mm:arc"
"""
block: # bug #22058
template foo(): auto =
{.noSideEffect.}:
newSeq[byte](1)
type V = object
v: seq[byte]
proc bar(): V =
V(v: foo())
doAssert bar().v == @[byte(0)]