summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/static-init.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-03-30 07:09:50 +0000
committerJohn McCall <rjmccall@apple.com>2012-03-30 07:09:50 +0000
commit49d26d2817180ccde605c987f79cd3a5b57639cd (patch)
treee300661d68dad6d9ccfb244cfa16a59be22944d9 /test/CodeGenCXX/static-init.cpp
parent5aeaca3fa755cddba583842e7a0c3e168bf71b4d (diff)
Do the static-locals thing properly in the face of unions and
other things which might mess with the variable's type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153733 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/static-init.cpp')
-rw-r--r--test/CodeGenCXX/static-init.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp
index ca47428fe2..7e840f5622 100644
--- a/test/CodeGenCXX/static-init.cpp
+++ b/test/CodeGenCXX/static-init.cpp
@@ -3,6 +3,7 @@
// CHECK: @_ZZ1hvE1i = internal global i32 0, align 4
// CHECK: @base_req = global [4 x i8] c"foo\00", align 1
+// CHECK: @_ZZN5test31BC1EvE1u = internal global { i8, [3 x i8] } { i8 97, [3 x i8] undef }, align 4
// CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16
// CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0
// CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0
@@ -129,3 +130,23 @@ namespace test2 {
// CHECK: store i32 [[T0]], i32* @_ZZN5test21BD1EvE1y,
// CHECK: call void @__cxa_guard_release(i64* @_ZGVZN5test21BD1EvE1y)
}
+
+// This shouldn't error out.
+namespace test3 {
+ struct A {
+ A();
+ ~A();
+ };
+
+ struct B : virtual A {
+ B();
+ ~B();
+ };
+
+ B::B() {
+ union U { char x; int i; };
+ static U u = { 'a' };
+ }
+ // CHECK: define void @_ZN5test31BC1Ev(
+ // CHECK: define void @_ZN5test31BC2Ev(
+}