On Saturday, 16 May 2015 at 02:04:39 UTC, Vlad Levenfeld wrote:
I think this code should be allowed, but it isn't:struct Functor (T) { T a; auto ref fmap (alias f)() { return Functor (f(a)); } } auto ref identity (T)(auto ref T a) { return a; } void main() { Functor!int a; static auto id (T)(T x) {return x;} a.fmap!identity; // ok a.fmap!id; // ok a.fmap!((int x) => x); // oka.fmap!(x => x); // Error: template instance fmap!((x) => x) cannot use local '__lambda1' as parameter to non-global template fmap(alias f)()}This seems like one of those things that doesn't work because of some compiler implementation detail rather than a consequence of the language rules but I'm not sure. Opinion?
very long standing compiler bug https://issues.dlang.org/show_bug.cgi?id=3051
