summary refs log tree commit diff stats
path: root/tests/vm/tcastnil.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vm/tcastnil.nim')
-rw-r--r--tests/vm/tcastnil.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/vm/tcastnil.nim b/tests/vm/tcastnil.nim
new file mode 100644
index 000000000..5a4684f95
--- /dev/null
+++ b/tests/vm/tcastnil.nim
@@ -0,0 +1,30 @@
+discard """
+  nimout: '''nil
+nil
+nil
+nil
+nil
+'''
+"""
+
+block:
+  static:
+    let a = cast[pointer](nil)
+    echo a.repr
+
+block:
+  static:
+    echo cast[ptr int](nil).repr
+
+block:
+  const str = cast[ptr int](nil)
+  static:
+    echo str.repr
+
+block:
+  static:
+    echo cast[ptr int](nil).repr
+
+block:
+  static:
+    echo cast[RootRef](nil).repr