Alignment of struct containing SIMD field - GDC

Johan Engelen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 1 11:09:24 PST 2017


On Wednesday, 1 March 2017 at 18:34:16 UTC, Iain Buclaw wrote:
>
> Simple test case would be:
>
> struct vec_struct {
>     bool b2;
>     struct {
>         bool b;
>         int8 field;
>     }
> }
>
> static assert(vec_struct.b.offsetof == 32);
> static assert(vec_struct.field.offsetof == 64);

With explicit align(32), it works:
https://godbolt.org/g/3GjOHW

- Johan


More information about the Digitalmars-d-learn mailing list