Release 0.41.92
[vala-gnome.git] / tests / structs / bug777194.vala
blobdef402e3509843f8b25a02a7afc5587020c75da2
1 struct Foo {
2 public int64 foo;
3 public int64 bar;
6 void bar (uint8[] a) {
7 unowned Foo[] f = (Foo[]) a;
8 assert (f[0].foo == 2LL << 62);
9 assert (f[0].bar == 2LL << 31);
12 void main () {
13 unowned uint8[] tu;
14 uint8[] to;
16 Foo fstack = { 2LL << 62 , 2LL << 31};
17 Foo? fheap = { 2LL << 62 , 2LL << 31};
19 bar ((uint8[]) &fstack);
20 tu = (uint8[]) &fstack;
21 assert (tu.length == 16);
22 bar (tu);
23 to = (uint8[]) &fstack;
24 assert (to.length == 16);
25 bar (to);
27 bar ((uint8[]) fstack);
28 tu = (uint8[]) fstack;
29 assert (tu.length == 16);
30 bar (tu);
31 to = (uint8[]) fstack;
32 assert (to.length == 16);
33 bar (to);
35 bar ((uint8[]) fheap);
36 tu = (uint8[]) fheap;
37 assert (tu.length == 16);
38 bar (tu);
39 to = (uint8[]) fheap;
40 assert (to.length == 16);
41 bar (to);
43 int32 i32 = 2 << 28;
44 tu = (uint8[]) i32;
45 assert (tu.length == 4);
46 tu = (uint8[]) &i32;
47 assert (tu.length == 4);
48 to = (uint8[]) i32;
49 assert (to.length == 4);
51 uint64 u64 = 2UL << 30;
52 tu = (uint8[]) u64;
53 assert (tu.length == 8);
54 tu = (uint8[]) &u64;
55 assert (tu.length == 8);
56 to = (uint8[]) u64;
57 assert (to.length == 8);