summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2020-04-13 13:17:22 +0100
committerGitHub <noreply@github.com>2020-04-13 14:17:22 +0200
commit8ba915e4498be3d17af894f5fb46c7b621ef5abb (patch)
tree2987dbec755ba838c79ed37f2113c1d4771ad00e /tests
parent814f15018432f7657ed12277790bd444b09a2edc (diff)
downloadNim-8ba915e4498be3d17af894f5fb46c7b621ef5abb.tar.gz
error msg for #13864 (#13962)
Co-authored-by: cooldome <ariabushenko@bk.ru>
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/tref_cast_error.nim15
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])