Nim/tests/destructor/tdestructor_too_late.nim
Andrii Riabushenko a055f628f4 fixes #12092
2019-08-31 09:49:47 +01:00

14 lines
No EOL
322 B
Nim

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)