[Issue 9184] New: std.algorithm.all fails to compile when providing a lambda

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 19 03:22:52 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9184

           Summary: std.algorithm.all fails to compile when providing a
                    lambda
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jens.k.mueller at gmx.de


--- Comment #0 from jens.k.mueller at gmx.de 2012-12-19 03:22:50 PST ---
test.d
---
unittest                                                                        
{                                                                               
    import std.algorithm;                                                       
    assert(all!(a => a >= 0)([1, 2, 3]));                                     
}
---

$ dmd -unittest -run test.d
fails with 
Error: function test.__unittest3.not!(__lambda2).not!(int).not is a nested
function and cannot be accessed from std.algorithm.find!(not,int[]).find

Changing std.algorithm.all to
return find!((a) => !unaryFun!pred(a))(range).empty;
works.
Though I'm not sure whether this is an appropriate fix. Please advice that I
can create a pull request.

$ dmd | head -1
DMD64 D Compiler v2.060

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list