[Issue 11932] New: alias this and sort produce wrong code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 15 15:56:19 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11932

           Summary: alias this and sort produce wrong code
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: simon.buerger at rwth-aachen.de


--- Comment #0 from Simon <simon.buerger at rwth-aachen.de> 2014-01-15 15:56:16 PST ---
When I use alias this to overload the comparison operators on a struct, sort
gives wrong results on some inputs (dmd 2.64.2, 64bit Ubuntu). Minimal example
to reproduce:

struct S
{
    int i;
    alias i this;
}

void main(string[] args)
{
    auto arr = [S(1000),S(2000)];
    arr[].sort;
    assert(arr[0] < arr[1]);
}

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


More information about the Digitalmars-d-bugs mailing list