[Issue 15091] New: Error passing lambda to std.algorithm.sorting.sort
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Sep 20 20:10:37 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15091
Issue ID: 15091
Summary: Error passing lambda to std.algorithm.sorting.sort
Product: D
Version: D2
Hardware: All
OS: Mac OS X
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: nicolas.jinchereau at gmail.com
Compiles fine in release mode, but gives error in debug mode:
dmd main.d -debug
module main;
import std.algorithm;
import std.container;
struct S {
int value;
}
void main(string[] args)
{
Array!S stuff = [S(3), S(1), S(2)];
stuff[].sort!((ref S a, ref S b) => a.value < b.value);
}
std/range/package.d(7180,24): Error:
'std.range.SortedRange!(RangeT!(Array!(S)),
__lambda2).SortedRange.dbgVerifySorted' is not nothrow
std/algorithm/sorting.d(982,29): Error: template instance
std.range.assumeSorted!(__lambda2, RangeT!(Array!(S))) error instantiating
main.d(75,9): instantiated from here: sort!(function (ref S a, ref S b) =>
a.value < b.value, cast(SwapStrategy)0, RangeT!(Array!(S)))
--
More information about the Digitalmars-d-bugs
mailing list