[Issue 17758] New: assignment of different vector types should require cast

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 17 03:52:56 PDT 2017


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 at puremagic.com
          Reporter: code at 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.

--


More information about the Digitalmars-d-bugs mailing list