Files
Nim/tests/arc/tref_cast_error.nim
cooldome 8ba915e449 error msg for #13864 (#13962)
Co-authored-by: cooldome <ariabushenko@bk.ru>
2020-04-13 14:17:22 +02:00

16 lines
327 B
Nim

discard """
cmd: "nim c --gc:arc $file"
errormsg: "expression cannot be cast to ref RootObj"
joinable: false
"""
type Variant* = object
refval: ref RootObj
proc newVariant*[T](val: T): Variant =
let pt = T.new()
pt[] = val
result = Variant(refval: cast[ref RootObj](pt))
var v = newVariant(@[1, 2, 3])