[Issue 2577] DMD crashes on foreach of undefined identifier

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 2 13:42:31 PDT 2009


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


clugdbug at yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch




------- Comment #3 from clugdbug at yahoo.com.au  2009-04-02 15:42 -------

in expression.c, in CallExp::canThrow(), around line 6660, type will be null if
the expression was invalid. Adding a null check fixes the segfault.

    /* If calling a function or delegate that is typed as nothrow,
     * then this expression cannot throw.
     * Note that pure functions can throw.
     */
        if (!e1->type) return 0;  // ---- add this line

    Type *t = e1->type->toBasetype();
    if (t->ty == Tfunction && ((TypeFunction *)t)->isnothrow)
        return 0;


-- 



More information about the Digitalmars-d-bugs mailing list