[Issue 14600] Lambda with body allowed as template alias argument
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon May 18 11:51:51 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14600
Ketmar Dark <ketmar at ketmar.no-ip.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Hardware|x86_64 |All
OS|Windows |All
--- Comment #1 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
it's actually a grammar issue. what `() => { writeln("testing"); }` does is
returns `void delegate () { writeln("testing"); }`.
i.e. `=> { writeln("testing"); }` is correctly parsed as *expression* which
returns delegate.
another thing is that compiler doesn't emit warnings by default. compiling the
code with "-w" flag gives this message:
Warning: calling z01.main.__lambda1 without side effects discards return value
of type void function() @safe, prepend a cast(void) if intentional
i think that the report can be closed as "not-a-bug". we'd better spam bugzilla
with "make warnings opt-out instead of opt-in" requests. ;-)
--
More information about the Digitalmars-d-bugs
mailing list