Files
Nim/tests/refc/tsinkbug.nim
ringabout d259099ef0 fixes #23759; rework move for refc (#23764)
fixes #23759

(cherry picked from commit 56ed4e0bb9)
2024-06-29 12:38:52 +02:00

27 lines
409 B
Nim

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
proc p(x: sink string) =
var y = move(x)
doAssert x.len == 0
doAssert y.len == 4
p("1234")
var s = "oooo"
p(s)