diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-03-03 23:03:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-03 16:03:53 +0100 |
commit | 572b0b67ff15373748dfdde4f470bd45641de990 (patch) | |
tree | 7bfb81c4928c8f5dceb0b74515d039cc5e8598e1 /tests/destructor/tsink.nim | |
parent | 31d755452485eccffa396e0e8432050a63b04c35 (diff) | |
download | Nim-572b0b67ff15373748dfdde4f470bd45641de990.tar.gz |
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.
Diffstat (limited to 'tests/destructor/tsink.nim')
-rw-r--r-- | tests/destructor/tsink.nim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/destructor/tsink.nim b/tests/destructor/tsink.nim new file mode 100644 index 000000000..82cbdfbe5 --- /dev/null +++ b/tests/destructor/tsink.nim @@ -0,0 +1,16 @@ +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() |