xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/2007-04-10-PackedUnion.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o /dev/null
2*f4a2713aSLionel Sambuc extern "C" {
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc #pragma pack(push, 2)
5*f4a2713aSLionel Sambuc   typedef struct ABC* abc;
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc   struct ABCS {
8*f4a2713aSLionel Sambuc     float red;
9*f4a2713aSLionel Sambuc     float green;
10*f4a2713aSLionel Sambuc     float blue;
11*f4a2713aSLionel Sambuc     float alpha;
12*f4a2713aSLionel Sambuc   };
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc   typedef void (*XYZ)();
15*f4a2713aSLionel Sambuc #pragma pack(pop)
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc union ABCU {
20*f4a2713aSLionel Sambuc   ABCS color;
21*f4a2713aSLionel Sambuc   XYZ bg;
22*f4a2713aSLionel Sambuc };
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc struct AData {
25*f4a2713aSLionel Sambuc   ABCU data;
26*f4a2713aSLionel Sambuc };
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc class L {
29*f4a2713aSLionel Sambuc  public:
L()30*f4a2713aSLionel Sambuc   L() {}
31*f4a2713aSLionel Sambuc   L(const L& other);
32*f4a2713aSLionel Sambuc 
33*f4a2713aSLionel Sambuc  private:
34*f4a2713aSLionel Sambuc   AData fdata;
35*f4a2713aSLionel Sambuc };
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc 
L(const L & other)38*f4a2713aSLionel Sambuc L::L(const L& other)
39*f4a2713aSLionel Sambuc {
40*f4a2713aSLionel Sambuc   fdata = other.fdata;
41*f4a2713aSLionel Sambuc }
42