diff options
author | John McCall <rjmccall@apple.com> | 2012-03-30 07:09:50 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-03-30 07:09:50 +0000 |
commit | 87590e60c088355ed0227da12f0ca04928b1e28f (patch) | |
tree | c32befa3a8dbd26e95c4cdd3ec2092c569215b23 /clang/test/CodeGenCXX/static-init.cpp | |
parent | 74c17c65e4f3627baa993ea621f22b1197559381 (diff) | |
download | bcm5719-llvm-87590e60c088355ed0227da12f0ca04928b1e28f.tar.gz bcm5719-llvm-87590e60c088355ed0227da12f0ca04928b1e28f.zip |
Do the static-locals thing properly in the face of unions and
other things which might mess with the variable's type.
llvm-svn: 153733
Diffstat (limited to 'clang/test/CodeGenCXX/static-init.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/static-init.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/static-init.cpp b/clang/test/CodeGenCXX/static-init.cpp index ca47428fe2c..7e840f5622d 100644 --- a/clang/test/CodeGenCXX/static-init.cpp +++ b/clang/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( +} |