[llvm-commits] CVS: llvm/test/Regression/C++Frontend/2005-02-11-AnonymousUnion.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Feb 11 11:26:23 PST 2005



Changes in directory llvm/test/Regression/C++Frontend:

2005-02-11-AnonymousUnion.cpp added (r1.1)
---
Log message:

New testcase for PR501: http://llvm.cs.uiuc.edu/PR501 



---
Diffs of the changes:  (+32 -0)

 2005-02-11-AnonymousUnion.cpp |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+)


Index: llvm/test/Regression/C++Frontend/2005-02-11-AnonymousUnion.cpp
diff -c /dev/null llvm/test/Regression/C++Frontend/2005-02-11-AnonymousUnion.cpp:1.1
*** /dev/null	Fri Feb 11 13:26:17 2005
--- llvm/test/Regression/C++Frontend/2005-02-11-AnonymousUnion.cpp	Fri Feb 11 13:26:06 2005
***************
*** 0 ****
--- 1,32 ----
+ // RUN: %llvmgxx %s -S -o -
+ 
+ // Test anonymous union with members of the same size.
+ int test1(float F) {
+   union {
+      float G;
+      int i;
+   };
+   G = F;
+   return i;
+ }
+ 
+ // test anonymous union with members of differing size.
+ int test2(short F) {
+   volatile union {
+      short G;
+      int i;
+   };
+   G = F;
+   return i;
+ }
+ 
+ // Make sure that normal unions work.  duh :)
+ volatile union {
+   short S;
+   int i;
+ } U;
+ 
+ int test3(short s) {
+   U.S = s;
+   return U.i;
+ }






More information about the llvm-commits mailing list