www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23769] New: Lambda isn't a unary predicate for lambda that

https://issues.dlang.org/show_bug.cgi?id=23769

          Issue ID: 23769
           Summary: Lambda isn't a unary predicate for lambda that doesn't
                    compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: grimmaple95 gmail.com

class A{
        bool t;
}

void main()
{
    A[] a = new A[100];
    writeln(a.all!(x => x.b));
}

This code errors at compile with:
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/searching.d(124): Error:
static assert:  "`__lambda2` isn't a unary predicate function for range.front"
onlineapp.d(10):        instantiated from here: `all!(A[])`

It should just output that the lambda doesn't compile.

I'm not sure if it's related to https://issues.dlang.org/show_bug.cgi?id=11907

--
Mar 10 2023