[Issue 5469] Limitation when instantiating templates in the context of a function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 9 13:08:20 PST 2013


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


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-02-09 13:08:17 PST ---
DMD 2.062 git-head now crashes without giving any errors.

The cause of the crash:

void markAsNeedingClosure(Dsymbol *f, FuncDeclaration *outerFunc)
{
    int x = 0;
    for (Dsymbol *sx = f; sx != outerFunc; sx = sx->parent)
    {
        FuncDeclaration *fy = sx->isFuncDeclaration();
        if (fy && fy->closureVars.dim)
        {
            /* fy needs a closure if it has closureVars[],
             * because the frame pointer in the closure will be accessed.
             */
            fy->requiresClosure = true;
        }
    }
}

'sx' is never checked if it's null, the for loop might have to be:

    for (Dsymbol *sx = f; sx /* <- added */ && sx != outerFunc; sx =
sx->parent)

-- 
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