https://issues.dlang.org/show_bug.cgi?id=15757
Issue ID: 15757
Summary: D main is a nested function and cannot be accessed
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
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
---------------
--