Bug 17372 – function 'std.algorithm.searching.skipOver!(Result, dstring).skipOver' is not nothrow

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-05-05T14:35:04Z
Last change time
2018-01-05T13:28:32Z
Assigned to
No Owner
Creator
Jonathan M Davis

Comments

Comment #0 by issues.dlang — 2017-05-05T14:35:04Z
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[])
Comment #1 by issues.dlang — 2017-05-05T14:59:20Z
Comment #2 by github-bugzilla — 2017-05-05T17:12:44Z
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 <[email protected]>
Comment #3 by github-bugzilla — 2017-06-17T11:34:39Z
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
Comment #4 by github-bugzilla — 2018-01-05T13:28:32Z
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