blob: 87ababc5f183a1aa2d81d1cd5641d00c110a2c59 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001// RUN: %llvmgxx %s -S -o -
2
3// Test anonymous union with members of the same size.
4int test1(float F) {
5 union {
6 float G;
7 int i;
8 };
9 G = F;
10 return i;
11}
12
13// test anonymous union with members of differing size.
14int test2(short F) {
15 volatile union {
16 short G;
17 int i;
18 };
19 G = F;
20 return i;
21}
22
23// Make sure that normal unions work. duh :)
Matthijs Kooijmanb0bf82d2008-06-10 14:37:44 +000024volatile union U_t {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000025 short S;
26 int i;
27} U;
28
29int test3(short s) {
30 U.S = s;
31 return U.i;
32}