* fix #15623

* add testcase for #15623

* fix

* add testcase
This commit is contained in:
flywind 2020-11-18 01:05:20 +08:00 • committed by GitHub
commit 0f7f159a35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 2 deletions

11
tests/ccgbugs/t15623.nim Normal file
View file

@ -0,0 +1,11 @@
discard """
action: "compile"
"""
# bug #15623
block:
echo cast[ptr int](nil)[]
block:
var x: ref int = nil
echo cast[ptr int](x)[]

View file

@ -0,0 +1,13 @@
discard """
output: '''0
0
'''
"""
# bug #15623
block:
echo cast[int](cast[ptr int](nil))
block:
var x: ref int = nil
echo cast[int](cast[ptr int](x))