diff options
-rw-r--r-- | compiler/vmgen.nim | 3 | ||||
-rw-r--r-- | tests/vm/tcastnil.nim | 30 |
2 files changed, 0 insertions, 33 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 069b8cbf5..bcb7faa47 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -901,9 +901,6 @@ proc genCastIntFloat(c: PCtx; n: PNode; dest: var TDest) = c.gABx(n, opcSetType, dest, c.genType(dst)) c.gABC(n, opcCastIntToPtr, dest, tmp) c.freeTemp(tmp) - elif src.kind == tyNil and dst.kind in PtrLikeKinds: - if dest < 0: dest = c.getTemp(n[0].typ) - genLit(c, n[1], dest) else: # todo: support cast from tyInt to tyRef globalError(c.config, n.info, "VM does not support 'cast' from " & $src.kind & " to " & $dst.kind) diff --git a/tests/vm/tcastnil.nim b/tests/vm/tcastnil.nim deleted file mode 100644 index 5a4684f95..000000000 --- a/tests/vm/tcastnil.nim +++ /dev/null @@ -1,30 +0,0 @@ -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 |