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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|SEG-V at expression.c:6255  |SEG-V at expression.c:6255
                   |from bad code               |from bad opDispatch


--- Comment #6 from Don <clugd...@yahoo.com.au> 2010-01-26 00:06:30 PST ---
Cause: If global.errors && !global.gag, TemplateInstance::semantic doesn't set
'inst'. So this is a possible patch (not recommended) inside template.c:

    {
    if (!global.gag)
    {
        /* Trying to soldier on rarely generates useful messages
         * at this point.
         */
        fatal();
    }
+    inst = this; // error recovery
    return;
    }
===
But, on the other hand, most other functions in expression.c only run
ti->semantic() if there are global.errors.

So this patch to expression.c line 6252 may be better:

Expression *DotTemplateInstanceExp::semantic(Scope *sc)
{
#if LOGSEMANTIC
    printf("DotTemplateInstanceExp::semantic('%s')\n", toChars());
#endif
    Expression *eleft;
    Expression *e = new DotIdExp(loc, e1, ti->name);
L1:
    e = e->semantic(sc);

    if (e->op == TOKdottd)
    {
+    if (global.errors) return new ErrorExp();
    DotTemplateExp *dte = (DotTemplateExp *)e;
    TemplateDeclaration *td = dte->td;

The same problem occurs in mtype.c, line 6613, 7101, inside ::dotExp(), for
structs and classes, and they should probably have the same fix.
(they shouldn't be running ti->semantic() if there are global errors).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to