From 8ba915e4498be3d17af894f5fb46c7b621ef5abb Mon Sep 17 00:00:00 2001 From: cooldome Date: Mon, 13 Apr 2020 13:17:22 +0100 Subject: error msg for #13864 (#13962) Co-authored-by: cooldome --- tests/arc/tref_cast_error.nim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/arc/tref_cast_error.nim (limited to 'tests') 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]) -- cgit 1.4.1-2-gfad0