scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

0051-inits.c (317B)


      1 struct S1 {
      2 	int a;
      3 	int b;
      4 };
      5 
      6 struct S2 {
      7 	int a;
      8 	int b;
      9 	union {
     10 		int c;
     11 		int d;
     12 	};
     13 	struct S1 s;
     14 };
     15 
     16 struct S2 v = {1, 2, 3, {4, 5}};
     17 
     18 int
     19 main()
     20 {
     21 	if(v.a != 1)
     22 		return 1;
     23 	if(v.b != 2)
     24 		return 2;
     25 	if(v.c != 3 || v.d != 3)
     26 		return 3;
     27 	if(v.s.a != 4)
     28 		return 4;
     29 	if(v.s.b != 5)
     30 		return 5;
     31 	
     32 	return 0;
     33 }