www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13073] New: Wrong uint array comparison

https://issues.dlang.org/show_bug.cgi?id=13073

          Issue ID: 13073
           Summary: Wrong uint array comparison
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

Tagged this as major, but it's borderline critical.

Found by "Archibald" and "anonymous" on NG D.learn:
http://forum.dlang.org/thread/oykqbalusjretfkquolz forum.dlang.org


void main() {
    uint x = 0x22_DF_FF_FF;
    uint y = 0xA2_DF_FF_FF;
    assert(!(x < y && y < x)); // OK.
    uint[] a = [x];
    uint[] b = [y];
    assert(!(a < b && b < a)); // Fails.
    uint[1] a1 = [x];
    uint[1] b1 = [y];
    assert(!(a1 < b1 && b1 < a1)); // Fails.
}

--
Jul 08 2014