www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17758] New: assignment of different vector types should

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

          Issue ID: 17758
           Summary: assignment of different vector types should require
                    cast
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
void test()
{
    __vector(float[4]) f4;
    __vector(uint[4]) u4;
    __vector(void[16]) v16;
    f4 = cast(typeof(f4)) u4; // OK
    f4 = u4; // should fail
    v16 = f4; // OK
    f4 = v16; // should fail
    f4 = cast(typeof(f4)) v16; // OK
}
CODE
dmd -c bug

It's somewhat broken that vectors of different types can be assigned without
any casting. This is OK for implicit conversions to void16 vectors, but not for
conversions from void16.

--
Aug 17 2017