You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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.
bearophile_hugs reported this on 2011-09-29T11:07:53Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=6742
CC List
Description
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() {}The text was updated successfully, but these errors were encountered: