summary refs log tree commit diff stats
path: root/tests/arc/tarcmisc.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-07-01 17:35:04 +0200
committerGitHub <noreply@github.com>2021-07-01 17:35:04 +0200
commit3ceaf5c1309ac8d4d68e6f39c13b021bcc1b15f4 (patch)
treeede7643ce84d25d810e490640e2eddd03094181c /tests/arc/tarcmisc.nim
parent779b4e307bdeb018bb2884920144a8c0d1f3b377 (diff)
downloadNim-3ceaf5c1309ac8d4d68e6f39c13b021bcc1b15f4.tar.gz
fixes #18030 (#18415)
Diffstat (limited to 'tests/arc/tarcmisc.nim')
-rw-r--r--tests/arc/tarcmisc.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim
index a52538085..5d5d8e914 100644
--- a/tests/arc/tarcmisc.nim
+++ b/tests/arc/tarcmisc.nim
@@ -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()