summary refs log tree commit diff stats
path: root/tests/destructor/tdestructor_too_late.nim
blob: d279280ba11afef28b3ce532686e37e6c4175c37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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)