summary refs log tree commit diff stats
path: root/tests/destructor/tinvalid_rebind.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/destructor/tinvalid_rebind.nim')
-rw-r--r--tests/destructor/tinvalid_rebind.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/destructor/tinvalid_rebind.nim b/tests/destructor/tinvalid_rebind.nim
new file mode 100644
index 000000000..0f15c8f9e
--- /dev/null
+++ b/tests/destructor/tinvalid_rebind.nim
@@ -0,0 +1,15 @@
+discard """
+joinable: false
+cmd: "nim check $file"
+errormsg: "cannot bind another '=destroy' to: Foo; previous declaration was constructed here implicitly: tinvalid_rebind.nim(12, 7)"
+line: 14
+"""
+
+type
+  Foo[T] = object
+
+proc main =
+  var f: Foo[int]
+
+proc `=destroy`[T](f: var Foo[T]) =
+  discard