xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o -
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc #ifdef PACKED
4*f4a2713aSLionel Sambuc #define P __attribute__((packed))
5*f4a2713aSLionel Sambuc #else
6*f4a2713aSLionel Sambuc #define P
7*f4a2713aSLionel Sambuc #endif
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc struct UnPacked {
10*f4a2713aSLionel Sambuc  	int X;
11*f4a2713aSLionel Sambuc 	int Y;
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc struct P M_Packed {
15*f4a2713aSLionel Sambuc   unsigned char A;
16*f4a2713aSLionel Sambuc   struct UnPacked B;
17*f4a2713aSLionel Sambuc };
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc struct M_Packed sM_Packed;
20*f4a2713aSLionel Sambuc 
testM_Packed(void)21*f4a2713aSLionel Sambuc int testM_Packed (void) {
22*f4a2713aSLionel Sambuc   struct M_Packed x;
23*f4a2713aSLionel Sambuc   return (x.B.Y != 0);
24*f4a2713aSLionel Sambuc }
25