mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
16 lines
329 B
Nim
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])
|