From a055f628f4354f6125e97c42bcf83f8e20149fac Mon Sep 17 00:00:00 2001 From: Andrii Riabushenko Date: Sat, 31 Aug 2019 09:49:47 +0100 Subject: fixes #12092 --- tests/destructor/tdestructor_too_late.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/destructor/tdestructor_too_late.nim (limited to 'tests') diff --git a/tests/destructor/tdestructor_too_late.nim b/tests/destructor/tdestructor_too_late.nim new file mode 100644 index 000000000..d279280ba --- /dev/null +++ b/tests/destructor/tdestructor_too_late.nim @@ -0,0 +1,14 @@ +discard """ + errmsg: "cannot bind another '=destroy' to: Obj; previous declaration was constructed here implicitly: tdestructor_too_late.nim(7, 16)" +""" +type Obj* = object + v*: int + +proc something(this: sink Obj) = + discard + +proc `=destroy`(this: var Obj) = + echo "igotdestroyed" + this.v = -1 + +var test* = Obj(v: 42) \ No newline at end of file -- cgit 1.4.1-2-gfad0