2008-08-21 10:51:29 +08:00
|
|
|
// RUN: clang %s -emit-llvm -o %t
|
2007-10-27 03:42:18 +08:00
|
|
|
|
2007-12-12 05:33:16 +08:00
|
|
|
union u_tag {
|
2007-10-27 03:42:18 +08:00
|
|
|
int a;
|
|
|
|
float b;
|
|
|
|
} u;
|
|
|
|
|
|
|
|
void f() {
|
|
|
|
u.b = 11;
|
|
|
|
}
|
|
|
|
|
2007-12-12 05:33:16 +08:00
|
|
|
float get_b(union u_tag *my_u) {
|
|
|
|
return my_u->b;
|
|
|
|
}
|
|
|
|
|
2007-10-27 03:42:18 +08:00
|
|
|
int f2( float __x ) {
|
|
|
|
union{
|
|
|
|
float __f;
|
|
|
|
unsigned int __u;
|
|
|
|
}__u;
|
|
|
|
return (int)(__u.__u >> 31);
|
|
|
|
}
|
2007-12-03 00:57:27 +08:00
|
|
|
|
|
|
|
typedef union { int i; int *j; } value;
|
|
|
|
|
|
|
|
int f3(value v) {
|
|
|
|
return *v.j;
|
|
|
|
}
|
2008-05-08 06:28:29 +08:00
|
|
|
|
|
|
|
enum E9 { one, two };
|
|
|
|
union S65 { enum E9 a:62; } ; union S65 s65;
|
|
|
|
void fS65() { enum E9 e = s65.a; }
|
|
|
|
|
2008-05-21 21:21:01 +08:00
|
|
|
typedef union{
|
|
|
|
unsigned char x[65536];
|
|
|
|
} q;
|
|
|
|
int qfunc() {q buf; unsigned char* x = buf.x;}
|
|
|
|
|
2008-05-29 19:33:25 +08:00
|
|
|
union RR {_Bool a : 1;} RRU;
|
|
|
|
int RRF(void) {return RRU.a;}
|
|
|
|
|