bcc icon indicating copy to clipboard operation
bcc copied to clipboard

[Generics] Segfault when stack importing TStack

Open GWRon opened this issue 4 years ago • 1 comments

When importing a file which contains a TStack definition (in a global, as field in a type) and imports another file which has a TStack, BCC segfaults. Exception is, if the "deepest" TStack is a generic one (TStack).

stack.bmx

SuperStrict
Framework Brl.StandardIO
Import "stack_import.bmx"

stack_import.bmx

SuperStrict
Import "stack_import_import.bmx"

Type TStackContainer
    'comment out do remove segfault
    Field _crashStack:TStack<TStackContainer>
End Type

stack_import_import.bmx

SuperStrict
Import brl.collections

Global config:TConfig = New TConfig
Type TConfig
    Field items:TStack<TConfigItem>
End Type


Type TConfigItem
End Type

But also stack.bmx

SuperStrict
Framework Brl.StandardIO
Import "stack_import.bmx"

stack_import.bmx

SuperStrict
Import "stack_import_import.bmx"

Global _crashStack:TStack<object>

stack_import_import.bmx

SuperStrict
Import brl.collections

Global items:TStack<TConfigItem>

Type TConfigItem
End Type

Here the interesting bit is: define Global items:TStack<TConfigItem> as Global items:TStack<object> and it does not segfault.

GWRon avatar Jul 11 '20 11:07 GWRon