mirror of https://github.com/rui314/chibicc
16 lines
558 B
C
16 lines
558 B
C
#include "test.h"
|
|
|
|
int main() {
|
|
ASSERT(8, ({ union { int a; char b[6]; } x; sizeof(x); }));
|
|
ASSERT(3, ({ union { int a; char b[4]; } x; x.a = 515; x.b[0]; }));
|
|
ASSERT(2, ({ union { int a; char b[4]; } x; x.a = 515; x.b[1]; }));
|
|
ASSERT(0, ({ union { int a; char b[4]; } x; x.a = 515; x.b[2]; }));
|
|
ASSERT(0, ({ union { int a; char b[4]; } x; x.a = 515; x.b[3]; }));
|
|
|
|
ASSERT(3, ({ union {int a,b;} x,y; x.a=3; y.a=5; y=x; y.a; }));
|
|
ASSERT(3, ({ union {struct {int a,b;} c;} x,y; x.c.b=3; y.c.b=5; y=x; y.c.b; }));
|
|
|
|
printf("OK\n");
|
|
return 0;
|
|
}
|