aboutsummaryrefslogtreecommitdiff
path: root/compiler/tests/verifier/sizeof.good
blob: 1202535ef219e3050e7221b46066cf0ff7f8dd0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

typedef incomplete Semipriv = (float64, int, private);

int ta;
(int) tb;
(int, int) tc;
int#[3] td;
float64 te;
(float64 d, byte b) tf;
Semipriv^ tg;

int sa = sizeof(ta);
int sb = sizeof(tb);
int sc = sizeof(tc);
int sd = sizeof(td);
int se = sizeof(te);
int sf = sizeof(tf);
int sf1 = sizeof(tf.d);
int sf2 = sizeof(tf.b);

int msa = minsizeof(ta);
int msb = minsizeof(tb);
int msc = minsizeof(tc);
int msd = minsizeof(td);
int mse = minsizeof(te);
int msf = minsizeof(tf);
int msf1 = minsizeof(tf.d);
int msf2 = minsizeof(tf.b);
//int msg = minsizeof(tg^); // TODO shouldn't be an error in this context

int aa = alignof(ta);
int ab = alignof(tb);
int ac = alignof(tc);
int ad = alignof(td);
int ae = alignof(te);
int af = alignof(tf);
int af1 = alignof(tf.d);
int af2 = alignof(tf.b);

// TODO test offsetof
/*int of1 = offsetof(tf.d);
int of2 = offsetof(tf.b);*/


count e1 = 1 + sizeof(ta);
count e2 = sizeof(ta) + 1;
count e3 = 1+2+3 + sizeof(ta) + 4;

count t1 = e3;
enum(x=e3,y) t2;
int#[e3] t3;


// This should return the size of the type
int u1 = sizeof(undefined as (int, long));
int u2 = alignof(undefined as (int, long));