mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 04:57:49 +00:00
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)
17 lines
244 B
Nim
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()
|