Comment #2 by bearophile_hugs — 2012-05-22T15:22:50Z
(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.
Comment #3 by andy — 2015-01-30T02:40:46Z
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.
Comment #4 by bugzilla — 2019-12-03T10:14:21Z
On linux, the current compile reports 8 / 16 / 16. As far as I understand this, this is correct. Did not test windows though.
Comment #5 by robert.schadek — 2024-12-01T16:14:29Z