http://d.puremagic.com/issues/show_bug.cgi?id=3235
Andrei Alexandrescu <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|TDPL: Function literals |[tdpl] Function literals |must be deduced as |must be deduced as |"function" or "delegate" |"function" or "delegate" --- Comment #6 from Andrei Alexandrescu <[email protected]> 2011-12-18 20:05:41 PST --- The following example is in TDPL: unittest { auto f = (int i) {}; assert(is(f == function)); } The example fails to compile (it should). Also the following example should work: unittest { int a; auto f = (int i) { a = i; }; assert(is(f == delegate)); } The compiler should automatically infer function or delegate type depending on the literal's use of local state. The argument against it - people change a detail in the body of the function and its type changes - is non sequitur. Changing a literal from 10 to 10.0 also changes its type. Please fix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
