D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17372 - function 'std.algorithm.searching.skipOver!(Result, dstring).skipOver' is not nothrow
Summary: function 'std.algorithm.searching.skipOver!(Result, dstring).skipOver' is not...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-05 14:35 UTC by Jonathan M Davis
Modified: 2018-01-05 13:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2017-05-05 14:35:04 UTC
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 Jonathan M Davis 2017-05-05 14:59:20 UTC
https://github.com/dlang/phobos/pull/5361
Comment 2 github-bugzilla 2017-05-05 17:12:44 UTC
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>
Comment 3 github-bugzilla 2017-06-17 11:34:39 UTC
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 github-bugzilla 2018-01-05 13:28:32 UTC
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