This commit is contained in:
Andreas Rumpf 2021-07-01 17:35:04 +02:00 • committed by GitHub
commit 3ceaf5c130
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View file

@ -28,6 +28,8 @@ aaaaa
hello
ok
true
copying
123
closed
destroying variable: 20
destroying variable: 10
@ -433,3 +435,31 @@ proc t17712 =
echo el != nil
t17712()
# bug #18030
type
Foo = object
n: int
proc `=copy`(dst: var Foo, src: Foo) =
echo "copying"
dst.n = src.n
proc `=sink`(dst: var Foo, src: Foo) =
echo "sinking"
dst.n = src.n
var a: Foo
proc putValue[T](n: T)
proc useForward =
putValue(123)
proc putValue[T](n: T) =
var b = Foo(n:n)
a = b
echo b.n
useForward()