1 static assert(isInitAllOneBits!char); 2 static assert(isInitAllOneBits!wchar); 3 static assert(!isInitAllOneBits!dchar); 4 5 static assert(isInitAllOneBits!(char[4])); 6 static assert(!isInitAllOneBits!(int[4])); 7 static assert(!isInitAllOneBits!Object); 8 9 static struct S1 10 { 11 char a; 12 char b; 13 } 14 static assert(isInitAllOneBits!S1); 15 16 static struct S2 17 { 18 char a = 1; 19 } 20 static assert(!isInitAllOneBits!S2); 21 22 static struct S3 23 { 24 S1 a; 25 char b; 26 } 27 static assert(isInitAllOneBits!S3); 28 static assert(isInitAllOneBits!(S3[2])); 29 30 static struct S4 31 { 32 S1 a; 33 S2 b; 34 } 35 static assert(!isInitAllOneBits!S4); 36 37 static struct Sshort 38 { 39 short r = cast(short)0xffff; 40 } 41 static assert(isInitAllOneBits!Sshort); 42 43 static struct Sint 44 { 45 int r = 0xffff_ffff; 46 } 47 static assert(isInitAllOneBits!Sint); 48 49 static struct Slong 50 { 51 long r = 0xffff_ffff_ffff_ffff; 52 } 53 static assert(isInitAllOneBits!Slong); 54 55 // Verify that when there is padding between fields isInitAllOneBits is false. 56 static struct S10 57 { 58 align(4) char a; 59 align(4) char b; 60 } 61 static assert(!isInitAllOneBits!S10); 62 63 static class C1 64 { 65 char c; 66 } 67 static assert(!isInitAllOneBits!C1);