digitalmars.D.bugs - [Issue 14454] New: Lambda template param doesn't compile with
- via Digitalmars-d-bugs (33/33) Apr 17 2015 https://issues.dlang.org/show_bug.cgi?id=14454
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 puremagic.com Reporter: dzugaru 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. --
Apr 17 2015