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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugd...@yahoo.com.au


--- Comment #1 from Don <clugd...@yahoo.com.au> 2011-05-24 21:40:59 PDT ---
Extended test cases (applies to delegate literals as well as inner functions):

void bug5396(int b)
{
    int inner() { return b; }
    static int staticInner() { return 6; }

    static assert(is(typeof(compiles!(
        function int () {    return 7;  }()
    ))));
    static assert(!is(typeof(compiles!(
        delegate int () {    return b;  }()
    ))));
    static assert(!is(typeof(compiles!(
        inner()
    ))));
    static assert(is(typeof(compiles!(
        staticInner()
    ))));
}

Patch in interpret.c, CallExp::interpret(). Problem is, this breaks bug 1461
which seems to be an important use case.

    if (!istate && fd && fd->isNested() && !fd->isStatic() &&
        /* BUG: Delegate literals report 'isNested()' even if they are
         * declared at module scope.
         */
        !(fd->isFuncLiteralDeclaration() &&
!fd->toParent2()->isFuncDeclaration()))
    {
        error("cannot directly interpret non-static nested function %s",
fd->toChars());
        return EXP_CANT_INTERPRET;
    }
    if (pthis && fd)
    {   // Member function call

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

Reply via email to