Bug 15757 – D main is a nested function and cannot be accessed
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-04T17:20:00Z
Last change time
2016-10-01T11:45:31Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
Jesse.K.Phillips+D
Comments
Comment #0 by Jesse.K.Phillips+D — 2016-03-04T17:20:21Z
I feel as though the code below should compile. If I move the inner struct "M" out of the scope of test() it compiles just fine.
---------------
import std.algorithm;
void main() @safe
{
[1,2,3].map!(x => x*x).test;
}
void test(R)(R r) {
struct M(R) {
@disable this();
this(R r) {
payload = r;
}
R payload;
}
M!R m = M!R(r);
}
---------------
$ dmd test.d
test.d(17): Error: function D main is a nested function and cannot be accessed from test.test!(MapResult!(__lambda1, int[])).test
---------------