auto r = [1,1,1,2,2,2,3,3,3]; writeln(r.chunkBy!((ref e1, ref e2) => e1 == e2)); Error: static assert: "chunkBy expects either a binary predicate or a unary predicate on range elements of type: int" The issue is that the test is using ElementType!Range.init as the parameters to the binary function. A workaround is to use auto ref (as the actual usage will be with lvalues).
@MoonlightSentinel created dlang/phobos pull request #7459 "Fix Issue 20496 - chunkby should support ref predicate" fixing this issue: - Fix Issue 20496 - chunkby should support ref predicate Provide an lvalue when checking the predicate https://github.com/dlang/phobos/pull/7459
dlang/phobos pull request #7459 "Fix Issue 20496 - chunkby should support ref predicate" was merged into master: - 8fd3b6d3a538ed347855b3fb046028b2f195bda6 by MoonlightSentinel: Fix Issue 20496 - chunkby should support ref predicate Provide an lvalue when checking the predicate https://github.com/dlang/phobos/pull/7459
Thanks! Now I just have to remember which code I added this workaround to... ;)