4 struct X1
{ ubyte b
; int n
; }
5 static assert(X1
.sizeof
== 8);
6 static assert(X1
.b
.offsetof
== 0);
7 static assert(X1
.n
.offsetof
== 4);
9 //assert(cast(void*)&x1.b == cast(void*)&x1 + 0);
10 //assert(cast(void*)&x1.n == cast(void*)&x1 + 1);
12 struct Y1
{ ubyte b
; int n
; }
13 static assert(Y1
.sizeof
== 8);
14 static assert(Y1
.b
.offsetof
== 0);
15 static assert(Y1
.n
.offsetof
== 4);
17 //assert(cast(void*)&y1.b == cast(void*)&y1 + 0);
18 //assert(cast(void*)&y1.n == cast(void*)&y1 + 4);
23 struct X2
{ ubyte b
; int n
; int f(){ return local
; } }
24 static assert(X2
.sizeof
== 8 + (void*).sizeof
);
25 static assert(X2
.b
.offsetof
== 0);
26 static assert(X2
.n
.offsetof
== 4);
28 //assert(cast(void*)&x2.b == cast(void*)&x2 + 0);
29 //assert(cast(void*)&x2.n == cast(void*)&x2 + 1);
31 struct Y2
{ ubyte b
; int n
; int f(){ return local
; } }
32 static assert(Y2
.sizeof
== 8 + (void*).sizeof
);
33 static assert(Y2
.b
.offsetof
== 0);
34 static assert(Y2
.n
.offsetof
== 4);
36 //assert(cast(void*)&y2.b == cast(void*)&y2 + 0);
37 //assert(cast(void*)&y2.n == cast(void*)&y2 + 4);