[Issue 15757] New: D main is a nested function and cannot be accessed
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Mar 4 09:20:21 PST 2016
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: nobody at puremagic.com
Reporter: Jesse.K.Phillips+D at gmail.com
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
---------------
--
More information about the Digitalmars-d-bugs
mailing list