aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/union.c
blob: 4d32abdf54dff3639cafa8725b58088e329a31e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// RUN: clang %s -emit-llvm

union u_tag {
  int a;
  float b;
} u;

void f() {
  u.b = 11;
}

float get_b(union u_tag *my_u) {
  return my_u->b;
}

int f2( float __x ) { 
  union{ 
    float __f; 
    unsigned int __u; 
  }__u;
  return (int)(__u.__u >> 31); 
}

typedef union { int i; int *j; } value;

int f3(value v) {
  return *v.j;
}