[Issue 16508] Alignment of class members is not respected. Affects new, scoped and classInstanceAlignment.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 9 15:53:56 UTC 2021


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

--- Comment #10 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to kinke from comment #9)
> (In reply to Max Samukha from comment #8)
> > > No problem there. But it's the size the compiler uses (for the init symbol,
> > > the TypeInfo.initializer() etc.), not some library bug, and it's working.
> > 
> > Bugs will most likely be revealed in those when/if the align attribute is
> > fixed and people start using it.
> 
> Nope - again, class instances are never stored consecutively. Only wrapper
> structs can be, and as long as they align the backing buffer as required,
> all is/will be working fine.

By that argument, a struct object is likewise an ephemeral entity with a
backing buffer of bytes, and therefore 'sizeof' of a struct should not include
the padding. We'd better stop at that to avoid a philosophical debate. A
template returning the desired result will be easy to define after the bugs are
fixed.

--


More information about the Digitalmars-d-bugs mailing list