Files
Nim/tests/destructor/tcast.nim
2019-03-04 22:44:23 +01:00

15 lines
338 B
Nim

# Make sure we don't walk cast[T] type section while injecting sinks/destructors
block:
type
XY[T] = object
discard
proc `=`[T](x: var XY[T]; v: XY[T]) {.error.}
proc `=sink`[T](x: var XY[T]; v: XY[T]) {.error.}
proc main[T]() =
var m = cast[ptr XY[T]](alloc0(sizeof(XY[T])))
doAssert(m != nil)
main[int]()