http://d.puremagic.com/issues/show_bug.cgi?id=4948
Summary: std.algorithm.sort asserts unexpectedly with certain comparators Product: D Version: D2 Platform: x86_64 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: peter.alexander...@gmail.com --- Comment #0 from Peter Alexander <peter.alexander...@gmail.com> 2010-09-26 14:10:13 PDT --- The following code asserts unexpectedly when compiled with DMD 2.048 using no flags. void main() { alias Tuple!(int, "x", int, "y") V; V[] vs = [V(3, 4), V(6, 8)]; float arg(V v) { return atan2(cast(float)v.y, cast(float)v.x); } bool order(V a, V b) { return arg(a) < arg(b); } sort!order(vs); } core.exception.asserter...@c:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(356): Attempting to fetch the front of an empty array It does not assert when the arg(V) function is replaced to be something more simple, and only asserts when vs has particular values. I suspect this has something to do with floating point inaccuracies with atan2, but haven't looked deep enough into the issue. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------