fixes #12092
This commit is contained in:
parent
9ae0dd611f
commit
a055f628f4
2 changed files with 16 additions and 2 deletions
14
tests/destructor/tdestructor_too_late.nim
Normal file
14
tests/destructor/tdestructor_too_late.nim
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue