• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 %s -emit-llvm -o -
2 
3 union u_tag {
4   int a;
5   float b;
6 } u;
7 
f()8 void f() {
9   u.b = 11;
10 }
11 
get_b(union u_tag * my_u)12 float get_b(union u_tag *my_u) {
13   return my_u->b;
14 }
15 
f2(float __x)16 int f2( float __x ) {
17   union{
18     float __f;
19     unsigned int __u;
20   }__u;
21   return (int)(__u.__u >> 31);
22 }
23 
24 typedef union { int i; int *j; } value;
25 
f3(value v)26 int f3(value v) {
27   return *v.j;
28 }
29 
30 enum E9 { one, two };
31 union S65 { enum E9 a; } ; union S65 s65;
fS65()32 void fS65() { enum E9 e = s65.a; }
33 
34 typedef union{
35   unsigned char x[65536];
36 } q;
qfunc()37 int qfunc() {q buf; unsigned char* x = buf.x;}
38 
39 union RR {_Bool a : 1;} RRU;
RRF(void)40 int RRF(void) {return RRU.a;}
41 
42 // PR6164
43 typedef union T0 { unsigned int : 0; } T0;
44 T0 t0;
45 
46 union { int large_bitfield: 31; char c } u2;
47 
48 struct dt_t_s {
49   union {
50     long long u : 56;
51   } __attribute__((packed));
52 };
53 struct {
54   struct {
55     struct {
56       struct dt_t_s t;
57     };
58   };
59 } a;
60