In DMD 2.056head std.variant.Algebraic seems to ignore alignment requirements: import std.variant: Algebraic; static assert(double.alignof == 8); struct Foo { double x; } alias Algebraic!(Foo) AFoo1; static assert(AFoo1.sizeof == 12); struct AFoo2 { bool b; double x; } static assert(AFoo2.sizeof == 16); void main() {}
Compiles and runs on 2.059 Win32
(In reply to comment #1) > Compiles and runs on 2.059 Win32 That's the problem. I think AFoo1.sizeof has to be 16 byte, to respect the algnment of doubles that is 8.
In DMD 2.066.1, I get: import std.variant: Algebraic; static assert(double.alignof == 8); // Error here, this should be 4. struct Foo { double x; } alias Algebraic!(Foo) AFoo1; static assert(AFoo1.sizeof == 12); struct AFoo2 { bool b; double x; } static assert(AFoo2.sizeof == 16); // Error here, it should be 12. void main() {} I'm not sure what that means though.
On linux, the current compile reports 8 / 16 / 16. As far as I understand this, this is correct. Did not test windows though.
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9585 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB