[Issue 2203] typeof(class.template.foo) crashes compiler

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


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


clugdbug at yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Version|2.015                       |1.031




------- Comment #2 from clugdbug at yahoo.com.au  2009-04-02 14:15 -------

The segfault is caused by this line in DotIdExp::semantic(Scope *sc)
 in expression.c, line 5348 (in DMD 2.027).

    Type *t1b = e1->type->toBasetype();

If the expression was invalid, e1->type is null, so it segfaults.

Adding a line like:

if (!e1->type) {error("invalid expression"); return e1;}

before line 5348 is sufficient to avoid the segfault, and the original valid
code will compile without error. Not sure what the error message should be,
though.


-- 



More information about the Digitalmars-d-bugs mailing list