diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2018-09-11 17:03:21 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-09-11 17:03:21 +0200 |
commit | e7d404340628ef2ca6170744a7df33e20cd0fc1a (patch) | |
tree | dc00e90d53ff536121c056dddcdf7bc2643472ce | |
parent | 9ba80d204407cafeaf195dbe7b144b16b84dca6e (diff) | |
download | Nim-e7d404340628ef2ca6170744a7df33e20cd0fc1a.tar.gz |
Always emit hti object types if needed (#8940)
The compiler is now smart enough to emit types only if needed without all the importc tricks. This also fixes a codegen bug where, if all the stars align correctly, typeinfo doesn't include any definition of `TNimType` but uses it. Found by @skilchen in #8938
-rw-r--r-- | lib/system/hti.nim | 2 | ||||
-rw-r--r-- | tests/ccgbugs/thtiobj.nim | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/system/hti.nim b/lib/system/hti.nim index bb3769ac4..9931fa11e 100644 --- a/lib/system/hti.nim +++ b/lib/system/hti.nim @@ -11,7 +11,7 @@ when declared(ThisIsSystem): # we are in system module: {.pragma: codegenType, compilerproc.} else: - {.pragma: codegenType, importc.} + {.pragma: codegenType.} type # This should be the same as ast.TTypeKind diff --git a/tests/ccgbugs/thtiobj.nim b/tests/ccgbugs/thtiobj.nim new file mode 100644 index 000000000..7a656905f --- /dev/null +++ b/tests/ccgbugs/thtiobj.nim @@ -0,0 +1,8 @@ +discard """ + targets: "c cpp" +""" + +import typeinfo + +var x = "" +discard (getPointer(toAny(x))) |