[Issue 8469] New: isSorted fails with predicate "a.length < b.length ? true : a < b"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 29 19:44:45 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8469

           Summary: isSorted fails with predicate "a.length < b.length ?
                    true : a < b"
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-07-29 19:44:44 PDT ---
This code fails the assertion:

import std.algorithm;
import std.stdio;

void main()
{
    string[] x = ["_10", "_20", "_100"];
    assert(isSorted!"a.length < b.length ? true : a < b"(x));
}

However, it _is_ sorted according to the predicate, so the assertion should
pass.

I ran into this because sort throws an AssertError sorting ["_100", "_10",
"_20"] using that predicate, claiming that the sorting failed, when it actually
succeeded. So, not only is this messing up isSorted, but it messes up sort in
non-release mode.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list