[Issue 2215] Forward reference enum with base type within a struct causes Segmentation Fault in the compiler

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 2 12:52:52 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2215





------- Comment #2 from clugdbug at yahoo.com.au  2009-04-02 14:52 -------
This is segfaulting in mtype.c, line 5156. If the enum is forward referenced,
it doesn't know if it's default-initialised, so defaultval is null -> segfault. 

int TypeEnum::isZeroInit()
{
    return sym->defaultval->isBool(FALSE);
}

Unfortunately, 'loc' is not a parameter to isZeroInit, so I don't know how to
give an error msg with missing line number.
There are actually two other places in TypeEnum where this problems happens:
isunsigned() uses memtype without checking.
hasPointers() uses toBaseType() without checking.

alignsize() probably gives error message without line number.


-- 



More information about the Digitalmars-d-bugs mailing list