[Issue 7290] New: Heap allocation with scoped delegate literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 14 00:55:30 PST 2012


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

           Summary: Heap allocation with scoped delegate literal
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dawg at dawgfoto.de


--- Comment #0 from dawg at dawgfoto.de 2012-01-14 00:55:28 PST ---
int foo(alias pred)(int val)
{
    return pred(val);
}

int bar(int val)
{
    scope pred = (int a) => a + val; //<- causes allocation
    return foo!(pred)(2);
}

void main()
{
    bar(3) == 5 || assert(0);
}

----

Related to resolved
http://d.puremagic.com/issues/show_bug.cgi?id=7120

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