nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.43k stars 1.47k forks source link

void type in object type causes internal error #3734

Closed skyfex closed 5 years ago

skyfex commented 8 years ago

I stumbled on an internal error while playing around.

type
    Application = object
        config: void

var app = Application.new
rubiks.nim(5, 9) Error: internal error: genTraverseProc()

I know that it's not supposed to work, so I'm just putting it up here so it can get a nicer error message in the future.

genotrance commented 6 years ago

Stack trace.

Hint: used config file 'c:\users\gt\Desktop\DL\programming\nimdevel\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: temp [Processing]
Traceback (most recent call last)
nim.nim(121)             nim
nim.nim(77)              handleCmdLine
main.nim(173)            mainCommand
main.nim(77)             commandCompileToC
modules.nim(242)         compileProject
modules.nim(182)         compileModule
passes.nim(250)          processModule
passes.nim(139)          processTopLevelStmt
cgen.nim(1375)           myProcess
ccgstmts.nim(1155)       genStmts
ccgexprs.nim(2266)       expr
ccgstmts.nim(277)        genVarStmt
ccgstmts.nim(227)        genSingleVar
ccgstmts.nim(23)         registerGcRoot
ccgtrav.nim(153)         genTraverseProcForGlobal
ccgtypes.nim(1241)       genTypeInfo
ccgtypes.nim(992)        genTypeInfoAux
ccgtypes.nim(1249)       genTypeInfo
ccgtypes.nim(1090)       genObjectInfo
ccgtypes.nim(1017)       genObjectFields
ccgtypes.nim(1072)       genObjectFields
cgen.nim(66)             t
SIGSEGV: Illegal storage access. (Attempt to read from nil?)