mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
Codegen fix for procs taking type(nil) (#9231)
This commit is contained in:
@@ -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])
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user