[Issue 16270] scoped Alignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 20 12:48:03 UTC 2022


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

kinke <kinke at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kinke at gmx.net
         Resolution|---                         |WORKSFORME

--- Comment #1 from kinke <kinke at gmx.net> ---
I'm not sure whether this hasn't worked in the past, but it now definitely
does:

```
struct S {
    align(4) {
        byte a;
        short b;
        bool c;
    }
    ulong d;
}

static assert(S.a.offsetof == 0);
static assert(S.b.offsetof == 4);
static assert(S.c.offsetof == 8);
static assert(S.d.offsetof == 16);
```

--


More information about the Digitalmars-d-bugs mailing list