[Issue 20112] __vector casts don't do type conversions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 23 09:57:01 UTC 2020


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Walter Bright <bugzilla at digitalmars.com> ---
It is indeed a reinterpret cast, although
https://issues.dlang.org/show_bug.cgi?id=21469 would cause that not to work
sometimes.

It is this way because of consistency with how casting of static arrays works:

  import core.stdc.stdio;

  void main() {
    byte[16] b = 3;
    int[4] ia = cast(int[4]) b;
    foreach (i; ia)
        printf("%x\n", i);
  }

which prints:

  3030303
  3030303
  3030303
  3030303

It is working as designed. At this point, I don't think this can be changed
even if we wanted to.

--


More information about the Digitalmars-d-bugs mailing list