core.simd ubyte16 initialization weirdness.

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon May 8 08:05:13 UTC 2023


On 08/05/2023 9:07 AM, realhet wrote:
> I just don't understand why the int array fails -> [1, 2, 3....] It 
> would look so nice.

It doesn't.

```d
import std, core.simd;

void main()
{
      enum ubyte16
          good1 = mixin([1, 2, 3, 4]),
          bad = [1, 2, 3, 4];

      static immutable ubyte16
          good2 = mixin([1, 2, 3, 4]),
          crash = [1, 2, 3, 4];

     writeln(good1);
     writeln(bad);
     writeln(good2);
     writeln(crash);
}
```

```
[1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
```

Its a bug with ``pragma(msg)`` by the looks.


More information about the Digitalmars-d-learn mailing list