[Issue 5753] Disallow map() of void function
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Aug 24 01:12:28 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=5753
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
CC| |razvan.nitu1305 at gmail.com
Resolution|--- |WORKSFORME
--- Comment #8 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to Ryuichi OHORI from comment #7)
> It seems that void lambda is not disallowed. DMD2.069 compiles the code
> below, which I think must not:
>
> void f(T)(T x){}
>
> unittest
> {
> import std.algorithm : map;
> static assert (!__traits(compiles, [1].map!f));
> static assert ( __traits(compiles, [1].map!(e => f(e))));
> }
I cannot reproduce this on git HEAD (ubuntu 16.04 64-bit). The second static
assert fails with the message "Error: static assert "Mapping function(s) must
not return void: tuple(__lambda1)"". Closing as WORKSFORME
--
More information about the Digitalmars-d-bugs
mailing list