Test case: import std.typecons; class C { int i; byte b; } void main() { auto sa = [scoped!C, scoped!C]; assert(cast(size_t)&sa[0].i % int.alignof == 0); assert(cast(size_t)&sa[1].i % int.alignof == 0); // fails } The problem is that the payload is declared as private ubyte[__traits(classInstanceSize, T)] Scoped_store = void; in std.typecons.scoped, as discussed at https://github.com/D-Programming-Language/phobos/pull/148#issuecomment-1590157 .
https://github.com/D-Programming-Language/phobos/pull/570
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/2503b18d1c6bba9e697e6eb0bf1914a65acdf215 Fix Issue 6580 - scoped classes are aligned incorrectly https://github.com/D-Programming-Language/phobos/commit/84218d3e1ebe5efb04b64e121a27870184334f84 Merge pull request #570 from denis-sh/scoped-bug6580-fix Fix Issue 6580 - scoped classes are aligned incorrectly