[Issue 14454] New: Lambda template param doesn't compile with -inline "*** is a nested function and cannot be accessed from ***"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 17 03:46:49 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14454

          Issue ID: 14454
           Summary: Lambda template param doesn't compile with -inline
                    "*** is a nested function and cannot be accessed from
                    ***"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: dzugaru at gmail.com

class Boo(alias func) {} 

class Foo
{    
    final auto Try()
    {
        return new Boo!((x) { return x; })();    
    }
}

void main()
{
    auto a = new Foo().Try();    
}

"dmd main.d" works, "dmd -inline main.d" doesn't with "main.d(7): Error:
function main.Foo.Try is a nested function and cannot be accessed from D main".
v.2.067. The culprit is the lambda param, using normal function works. Using 
"return new Boo!(function int(int x) { return x; })();" works too. Using
"return new Boo!(function (x) { return x; })();" doesn't work.

--


More information about the Digitalmars-d-bugs mailing list