Fix std.variant unittest

Accomodate for the fact that a `VariantN!24` without explicit allowed
types is at least `real` aligned, and that can be 8 on some platforms
(e.g., 32-bit Windows for LDC with 64-bit `real`), so that the size is
aligned up to `24+4 + /*padding*/ 4 = 32`.
This commit is contained in:
Martin Kinkelin 2019-08-26 23:36:25 +02:00 committed by ZombineDev
parent 9b58623d75
commit fe38be185b

View file

@ -1240,7 +1240,9 @@ public:
@safe unittest @safe unittest
{ {
assert(VariantN!(24).sizeof == 24 + (void*).sizeof); alias V = VariantN!24;
const alignMask = V.alignof - 1;
assert(V.sizeof == ((24 + (void*).sizeof + alignMask) & ~alignMask));
} }
/// Can also assign class values /// Can also assign class values