tdestructor_too_late.nim 324 B

1234567891011121314
  1. discard """
  2. errormsg: "cannot bind another '=destroy' to: Obj; previous declaration was constructed here implicitly: tdestructor_too_late.nim(7, 16)"
  3. """
  4. type Obj* = object
  5. v*: int
  6. proc something(this: sink Obj) =
  7. discard
  8. proc `=destroy`(this: var Obj) =
  9. echo "igotdestroyed"
  10. this.v = -1
  11. var test* = Obj(v: 42)