Files
Nim/tests/arc/tref_cast_error.nim
konsumlamm 18cea8e9bd Update message for checking cast (#20145)
* Update message for checking `cast`

* Update error messages in tests
2022-09-28 13:59:27 +02:00

16 lines
329 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])