Codegen fix for procs taking type(nil) (#9231)
This commit is contained in:
parent
b8d2f79ef0
commit
505ae14f4b
2 changed files with 7 additions and 1 deletions
|
|
@ -290,7 +290,7 @@ proc getSimpleTypeDesc(m: BModule, typ: PType): Rope =
|
||||||
of tyCString: result = typeNameOrLiteral(m, typ, "NCSTRING")
|
of tyCString: result = typeNameOrLiteral(m, typ, "NCSTRING")
|
||||||
of tyBool: result = typeNameOrLiteral(m, typ, "NIM_BOOL")
|
of tyBool: result = typeNameOrLiteral(m, typ, "NIM_BOOL")
|
||||||
of tyChar: result = typeNameOrLiteral(m, typ, "NIM_CHAR")
|
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:
|
of tyInt..tyUInt64:
|
||||||
result = typeNameOrLiteral(m, typ, NumericalTypeToStr[typ.kind])
|
result = typeNameOrLiteral(m, typ, NumericalTypeToStr[typ.kind])
|
||||||
of tyDistinct, tyRange, tyOrdinal: result = getSimpleTypeDesc(m, typ.sons[0])
|
of tyDistinct, tyRange, tyOrdinal: result = getSimpleTypeDesc(m, typ.sons[0])
|
||||||
|
|
|
||||||
6
tests/ccgbugs/tnil_type.nim
Normal file
6
tests/ccgbugs/tnil_type.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
discard """
|
||||||
|
targets: "c cpp"
|
||||||
|
"""
|
||||||
|
|
||||||
|
proc foo(v: type(nil)) = discard
|
||||||
|
foo nil
|
||||||
Loading…
Add table
Add a link
Reference in a new issue