diff options
-rw-r--r-- | compiler/ccgtypes.nim | 2 | ||||
-rw-r--r-- | tests/ccgbugs/tnil_type.nim | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 56a4704f9..8ae050605 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -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]) diff --git a/tests/ccgbugs/tnil_type.nim b/tests/ccgbugs/tnil_type.nim new file mode 100644 index 000000000..44ecf1cc9 --- /dev/null +++ b/tests/ccgbugs/tnil_type.nim @@ -0,0 +1,6 @@ +discard """ + targets: "c cpp" +""" + +proc foo(v: type(nil)) = discard +foo nil |