fixes #23354; [backport] (#23685)

(cherry picked from commit 7039b8b5bc)
This commit is contained in:
Andreas Rumpf
2024-06-07 09:01:30 +02:00
committed by narimiran
parent d6bc8699b9
commit 36f8cccda4
2 changed files with 20 additions and 0 deletions

17
tests/refc/tsinkbug.nim Normal file
View File

@@ -0,0 +1,17 @@
discard """
matrix: "--gc:refc; --gc:arc"
output: '''
Value is: 42
Value is: 42'''
"""
type AnObject* = object of RootObj
value*: int
proc mutate(a: sink AnObject) =
a.value = 1
var obj = AnObject(value: 42)
echo "Value is: ", obj.value
mutate(obj)
echo "Value is: ", obj.value