diff options
Diffstat (limited to 'tests/arc/tref_cast_error.nim')
-rw-r--r-- | tests/arc/tref_cast_error.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/arc/tref_cast_error.nim b/tests/arc/tref_cast_error.nim new file mode 100644 index 000000000..b0d2faf77 --- /dev/null +++ b/tests/arc/tref_cast_error.nim @@ -0,0 +1,15 @@ +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]) |