Bug 14454 – Lambda template param doesn't compile with -inline "*** is a nested function and cannot be accessed from ***"
Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-17T10:46:00Z
Last change time
2015-06-30T05:26:04Z
Keywords
rejects-valid
Assigned to
nobody
Creator
dzugaru
Comments
Comment #0 by dzugaru — 2015-04-17T10:46:49Z
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.
Comment #1 by dlang-bugzilla — 2015-04-27T08:07:05Z
(In reply to Vladimir Panteleev from comment #1)
> This program compiles fine with git master.
>
> Fixed by: https://github.com/D-Programming-Language/dmd/pull/4453
The root compiler issue is same with 7104.
*** This issue has been marked as a duplicate of issue 7104 ***