www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - inconsistent behavior with "is a nested function and cannot be

The code below fails to compile with:

Error: function 
is a nested function and cannot be accessed from 

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(){
	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;
Sep 18 2012