This code fails to compile import std.algorithm; import std.range; import std.uni; void main() { auto a = [["foo bar"], ["baz"]].map!(line => line.joiner(" ")).array.sort!((a, b) => icmp(a, b) < 0); } and gives this error: /usr/include/dmd/std/uni.d(7082): Error: function 'std.algorithm.searching.skipOver!(Result, dstring).skipOver' is not nothrow /usr/include/dmd/std/uni.d(7055): Error: nothrow function 'std.uni.fullCasedCmp!(Result).fullCasedCmp' may throw /usr/include/dmd/std/uni.d(7136): Error: template instance std.uni.fullCasedCmp!(Result) error instantiating qd.d(7): instantiated from here: icmp!(Result, Result) /usr/include/dmd/std/algorithm/sorting.d(1851): instantiated from here: __lambda2!(Result, Result) qd.d(7): instantiated from here: sort!((a, b) => icmp(a, b) < 0, cast(SwapStrategy)0, Result[]) /usr/include/dmd/std/algorithm/sorting.d(1863): Error: static assert "Invalid predicate passed to sort: __lambda2" qd.d(7): instantiated from here: sort!((a, b) => icmp(a, b) < 0, cast(SwapStrategy)0, Result[])
https://github.com/dlang/phobos/pull/5361
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/27330e76b72393ebb611176ea5600c94e447f067 issue# 17372: icmp chokes on a lambda that can throw. This removes some inappropriate attributes from a fullCasedCmp. It's templated, and their applicability depends on the template argument, so they should be inferred. And the unit tests for icmp which test the attributes (including @safe) pass without the attributes on fullCasedCmp, so I have no idea why any of them (particularly @trusted) were ever there. https://github.com/dlang/phobos/commit/0b1f13fd517cf8b7bb26042e07cd920480215e74 Merge pull request #5361 from jmdavis/issue_17372 issue# 17372: icmp chokes on a lambda that can throw. merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/27330e76b72393ebb611176ea5600c94e447f067 issue# 17372: icmp chokes on a lambda that can throw. https://github.com/dlang/phobos/commit/0b1f13fd517cf8b7bb26042e07cd920480215e74 Merge pull request #5361 from jmdavis/issue_17372
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/27330e76b72393ebb611176ea5600c94e447f067 issue# 17372: icmp chokes on a lambda that can throw. https://github.com/dlang/phobos/commit/0b1f13fd517cf8b7bb26042e07cd920480215e74 Merge pull request #5361 from jmdavis/issue_17372