[Issue 1586] DMD and GDC segfaults on incomplete code segment.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 28 02:10:18 PDT 2007


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





------- Comment #2 from braddr at puremagic.com  2007-10-28 04:10 -------
The segv is in this code:

Expression *DotTemplateInstanceExp::semantic(Scope *sc)
...
    if (!s2)
    {   error("template identifier %s is not a member of %s %s", id->toChars(),
s->kind(), s->ident ? s->ident->toChars() : "(null)");
        goto Lerr;
    }
...

s->ident is null, so s->ident->toChars() is invalid.  I added the ?: expression
to validate that, and here's the resulting error message: 
/home/braddr/sandbox/d/bugs/bug1586.d:5: template instance identifier 'NotHere'
is not defined
/home/braddr/sandbox/d/bugs/bug1586.d:5: Error: template identifier Bar is not
a member of template instance (null)

My fix is wrong, but hopefully this will save Walter a few minutes of narrowing
down.


-- 



More information about the Digitalmars-d-bugs mailing list