[Issue 8693] New: inconsistent behavior with "is a nested function and cannot be accessed from"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 18 23:46:30 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8693

           Summary: inconsistent behavior with "is a nested function and
                    cannot be accessed from"
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thelastmammoth at gmail.com


--- Comment #0 from thelastmammoth at gmail.com 2012-09-18 23:47:29 PDT ---
The code below fails to compile with:

Error: function 
main.fun!(cast(ModeScore)0,int).fun.map!(__lambda33).map!(int[]).map 
is a nested function and cannot be accessed from 
main.fun!(cast(ModeScore)1,int).fun

which is weird.
But then comment out line B or line A (see below) and it works, 
which is even weirder.

Is that a bug?

----
import std.algorithm;
void main(){
    int[]as;
    auto scores=as.map!(a=>a.fun!(ModeScore.u));   //line A
    auto scores2=as.map!(a=>a.fun!(ModeScore.v)); //line B
}
enum ModeScore {u,v}
auto fun(ModeScore modeScore=ModeScore.sum,T)(T a){
    auto scores=[a].map!(b=>b);
    return 0;
}
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list