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 ---------------
Comment #1 by k.hara.pg — 2016-03-24T16:26:53Z
Comment #2 by github-bugzilla — 2016-03-28T09:26:40Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/35936ea3a5f3bcafebf1fd746a71aca7694e4af6 fix Issue 15757 - D main is a nested function and cannot be accessed https://github.com/D-Programming-Language/dmd/commit/d7a46615f3849450979c8e5fa384bc7035db8c11 Merge pull request #5574 from 9rnsr/fix15757 Issue 15757 - D main is a nested function and cannot be accessed
Comment #3 by github-bugzilla — 2016-10-01T11:45:31Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/35936ea3a5f3bcafebf1fd746a71aca7694e4af6 fix Issue 15757 - D main is a nested function and cannot be accessed https://github.com/dlang/dmd/commit/d7a46615f3849450979c8e5fa384bc7035db8c11 Merge pull request #5574 from 9rnsr/fix15757