Codegen fix for procs taking type(nil) (#9231)

This commit is contained in:
xzfc
2018-10-09 19:51:34 +07:00
committed by Andreas Rumpf
parent b8d2f79ef0
commit 505ae14f4b
2 changed files with 7 additions and 1 deletions

View File

@@ -290,7 +290,7 @@ proc getSimpleTypeDesc(m: BModule, typ: PType): Rope =
of tyCString: result = typeNameOrLiteral(m, typ, "NCSTRING")
of tyBool: result = typeNameOrLiteral(m, typ, "NIM_BOOL")
of tyChar: result = typeNameOrLiteral(m, typ, "NIM_CHAR")
of tyNil: result = typeNameOrLiteral(m, typ, "0")
of tyNil: result = typeNameOrLiteral(m, typ, "void*")
of tyInt..tyUInt64:
result = typeNameOrLiteral(m, typ, NumericalTypeToStr[typ.kind])
of tyDistinct, tyRange, tyOrdinal: result = getSimpleTypeDesc(m, typ.sons[0])

View File

@@ -0,0 +1,6 @@
discard """
targets: "c cpp"
"""
proc foo(v: type(nil)) = discard
foo nil