mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
@@ -674,7 +674,7 @@ proc getConstExpr(m: PSym, n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode
|
||||
of nkCast:
|
||||
var a = getConstExpr(m, n[1], idgen, g)
|
||||
if a == nil: return
|
||||
if n.typ != nil and n.typ.kind in NilableTypes and a.kind != nkNilLit:
|
||||
if n.typ != nil and n.typ.kind in NilableTypes:
|
||||
# we allow compile-time 'cast' for pointer types:
|
||||
result = a
|
||||
result.typ = n.typ
|
||||
|
||||
@@ -365,7 +365,7 @@ const SCHED_RR* = cint(2)
|
||||
const SCHED_OTHER* = cint(0)
|
||||
|
||||
# <semaphore.h>
|
||||
const SEM_FAILED* = nil
|
||||
const SEM_FAILED* = cast[pointer]((nil))
|
||||
|
||||
# <signal.h>
|
||||
const SIGEV_NONE* = cint(1)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
discard """
|
||||
action: "compile"
|
||||
"""
|
||||
|
||||
# bug #15623
|
||||
block:
|
||||
echo cast[ptr int](nil)[]
|
||||
|
||||
block:
|
||||
var x: ref int = nil
|
||||
echo cast[ptr int](x)[]
|
||||
@@ -1,13 +0,0 @@
|
||||
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))
|
||||
Reference in New Issue
Block a user