Do not walk into type sub-nodes for cast/conv expr (#10616)

This commit is contained in:
LemonBoy 2019-02-09 19:55:26 +01:00 • committed by Andreas Rumpf
commit d83520ec8f
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,18 @@
discard """
cmd: '''nim c --newruntime $file'''
"""
# 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]()