Thread overview
[Issue 6520] New: Problem with -inline with lazy arguments and inner functions
Apr 26, 2012
SomeDude
August 17, 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@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
April 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6520


SomeDude <lovelydear@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear@mailmetrash.com


--- Comment #1 from SomeDude <lovelydear@mailmetrash.com> 2012-04-26 11:40:42 PDT ---
Compiles fine with -inline on 2.059 Win32

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6520


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from bearophile_hugs@eml.cc 2012-04-26 13:07:56 PDT ---
(In reply to comment #1)
> Compiles fine with -inline on 2.059 Win32

Thank you.

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