[Issue 7585] functions in templates inferred as delegate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 25 20:21:06 PST 2012


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



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-02-25 20:21:04 PST ---
The root cause is conservative escape analysis for nested template
instantiation.

extern(C) alias void function() Callback;

template Wrap(alias dg)
{
    extern(C) void Wrap() { dg(); }
}

void f1(){}

void main()
{
    static void f2(){}
    void f3(){}

    Callback cb1 = &Wrap!(f1);      // OK
    Callback cb2 = &Wrap!(f2);      // OK
    Callback cb3 = &Wrap!(f3);      // NG
    Callback cb3 = &Wrap!((){});    // NG
}

Current implementation always treats lambda literal as nested symbol.

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