www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13154] New: Incorrect init of static float array when sliced

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

          Issue ID: 13154
           Summary: Incorrect init of static float array when sliced
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: dbugreporter gmail.com

void main() {
    int[3] ints      = [2   , 1   , 0   , 1   ][0..3];
    float[3] floats0 = [2f  , 1f  , 0f  , 1f  ][0..3];
    float[3] floats1 = [2.0 , 1.0 , 0.0 , 1.0 ][0..3];  // fails!
    float[3] floats2 = [2.0f, 1.0f, 0.0f, 1.0f][0..3];
    assert(ints == [2, 1, 0]);
    assert(floats0 == [2, 1, 0]);
    assert(floats1 == [2, 1, 0]); // fail!
    assert(floats1 != [0, 0, 0]); // fail!
    assert(floats2 == [2, 1, 0]);
}

All this still worked with v.2065.

--
Jul 17 2014