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

           Summary: Can't inline function literal
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-12-25 
19:31:50 PST ---
I can't tell if this is a bug, I was just playing with it and it's not
important to me:

void foo(alias dg)() {
    dg();
}

void test() {
    foo!({ int x; })();
}

void main() {
    test();
}

$ dmd test.d
ok

$ dmd -inline test.d
test.d(3): Error: function test.test.foo!(delegate pure nothrow @safe void()
{
int x = 0;
}
).foo is a nested function and cannot be accessed from main

Note that if I make it a delegate literal it will compile:

void foo(alias dg)() {
    dg();
}

void test() {
    int y;
    foo!({ int x = y; })();
}

void main() {
    test();
}

$ dmd -inline test.d
ok

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

Reply via email to