[Issue 3292] ICE(todt.c) when using a named mixin with an initializer as template alias parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 12 01:55:38 PDT 2009


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


Don <clugdbug at yahoo.com.au> changed:

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


--- Comment #3 from Don <clugdbug at yahoo.com.au> 2009-10-12 01:55:37 PDT ---
This is happening because in this situation, when TemplateMixin::semantic() is
called, semanticRun is already 3.

The members get syntax copied:
    // Copy the syntax trees from the TemplateDeclaration
    members = Dsymbol::arraySyntaxCopy(tempdecl->members);

But this destroys their type info, and then since semanticRun is 3, semantic2
never gets run, hence semantic() never gets called on the members ---> they
have no type.

I don't think this mixin should be run at all, if it's already done the
semantic3 pass. (Note: I have NOT tested this patch against the DMD test
suite).

PATCH:
Line 4457, in template.c, TemplateMixin::semantic(Scope *sc) 

    if (!semanticRun)
    semanticRun = 1;
+    if (semanticRun >1) return;

----------------------------
But I'm not sure if this is the correct place to do this check. Should it be
being asked to do the semantic at all? It's being called from
AliasDeclaration::semantic(), and I'm not sure why:

    if (aliassym)
    {
    if (aliassym->isTemplateInstance()) {
        aliassym->semantic(sc);  // Is this correct??
    }
        return;
    }

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


More information about the Digitalmars-d-bugs mailing list