mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 10:06:05 +00:00

2005-02-11-AnonymousUnion.cpp 2005-02-13-BadDynamicInit.cpp 2005-02-14-BitFieldOffset.cpp 2005-02-19-BitfieldStructCrash.cpp 2005-02-19-UnnamedVirtualThunkArgument.cpp 2005-02-20-BrokenReferenceTest.cpp 2006-03-01-GimplifyCrash.cpp 2006-03-06-C++RecurseCrash.cpp 2006-09-12-OpaqueStructCrash.cpp 2006-10-30-ClassBitfield.cpp 2006-11-20-GlobalSymbols.cpp 2006-11-20-GlobalSymbols.ll 2006-11-30-ConstantExprCrash.cpp from llvm/test/FrontendC++. llvm-svn: 138148
33 lines
472 B
C++
33 lines
472 B
C++
// RUN: %clang_cc1 %s -emit-llvm -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 U_t {
|
|
short S;
|
|
int i;
|
|
} U;
|
|
|
|
int test3(short s) {
|
|
U.S = s;
|
|
return U.i;
|
|
}
|