aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/20-empty.c
blob: 29261853770bc7b5f286b4ec46ab0d33d086d0b1 (plain) (blame)
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
/* EXPECT:
sizeof (struct empty) === 0
sizeof bleh[1] === 0
sizeof (struct flx0) == sizeof (int) === 1
sizeof (a) === 0
sizeof (aa) === 0
*/

void f(){}

struct empty {};
extern struct empty bleh[10];
struct flx0 { int t; int m[0]; };

int main() {
   int a[] = {};
   int aa[][0] = {};
   struct empty empty = {};

   extern int printf(const char *, ...);
#define P(x) printf(#x" === %d\n", (int)x)
   P(sizeof (struct empty));
   P(sizeof bleh[1]);
   P(sizeof (struct flx0) == sizeof (int));
   P(sizeof (a));
   P(sizeof (aa));
}