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
This commit is contained in:
parent
9ba80d2044
commit
e7d4043406
2 changed files with 9 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ when declared(ThisIsSystem):
|
||||||
# we are in system module:
|
# we are in system module:
|
||||||
{.pragma: codegenType, compilerproc.}
|
{.pragma: codegenType, compilerproc.}
|
||||||
else:
|
else:
|
||||||
{.pragma: codegenType, importc.}
|
{.pragma: codegenType.}
|
||||||
|
|
||||||
type
|
type
|
||||||
# This should be the same as ast.TTypeKind
|
# This should be the same as ast.TTypeKind
|
||||||
|
|
|
||||||
8
tests/ccgbugs/thtiobj.nim
Normal file
8
tests/ccgbugs/thtiobj.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
discard """
|
||||||
|
targets: "c cpp"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import typeinfo
|
||||||
|
|
||||||
|
var x = ""
|
||||||
|
discard (getPointer(toAny(x)))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue