Bug 15091 – Error passing lambda to std.algorithm.sorting.sort

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-09-21T03:10:00Z
Last change time
2015-09-24T00:33:15Z
Keywords
diagnostic
Assigned to
nobody
Creator
nicolas.jinchereau

Comments

Comment #0 by nicolas.jinchereau — 2015-09-21T03:10:37Z
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)))
Comment #1 by jiki — 2015-09-24T00:33:15Z
*** This issue has been marked as a duplicate of issue 14981 ***