Files
Nim/tests/destructor/tsink.nim
ringabout e15aa20059 fixes sink regression for ORC; ref #23354 (#23359)
ref #23354

The new move analyzer requires types that have the tfAsgn flag
(otherwise `lastRead` will return true); tfAsgn is included when the
destructor is not trival. But it should consider the assignement for
objects in this case because objects might have a trival destructors but
it's the assignement that matters when it is passed to sink parameters.

(cherry picked from commit 572b0b67ff)
2024-04-22 10:22:28 +02:00

17 lines
244 B
Nim

discard """
matrix: "--mm:arc"
"""
type AnObject = object of RootObj
value*: int
proc mutate(shit: sink AnObject) =
shit.value = 1
proc foo = # bug #23359
var bar = AnObject(value: 42)
mutate(bar)
doAssert bar.value == 42
foo()