mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-23 07:45:23 +00:00
(cherry picked from commit 7039b8b5bc)
This commit is contained in:
17
tests/refc/tsinkbug.nim
Normal file
17
tests/refc/tsinkbug.nim
Normal 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
|
||||
Reference in New Issue
Block a user