[Issue 6520] New: Problem with -inline with lazy arguments and inner functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 17 07:47:53 PDT 2011


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

           Summary: Problem with -inline with lazy arguments and inner
                    functions
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-08-17 07:47:52 PDT ---
A reduced program:


int foo(int n, lazy int x) {
    int inner() {
        n--;
        return foo(n, inner());
    };
    return n <= 0 ? n : inner();
}
void main() {
    assert(foo(10, 1) == 0);
}



With DMD 2.055beta it compiles and runs correctly.

But compiling it with -inline DMD gives:

test.d(4): Error: delegate test.foo.inner.__dgliteral3 is a nested function and
cannot be accessed from foo

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