diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-12-10 08:25:00 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-12-10 08:25:00 +0000 |
commit | 6e39d2226ad4b2426434153c56de8670a60eec36 (patch) | |
tree | 78dd67781315c08a84fc844524e908d5560e4ca0 /test/CodeGenCXX/member-init-anon-union.cpp | |
parent | 3071f44f362397a188b0899f7f6f5e7c53377d19 (diff) |
Implement DR1460: fix handling of default initializers in unions; don't allow
more than one such initializer in a union, make mem-initializers override
default initializers for other union members, handle anonymous unions with
anonymous struct members better. Fix a couple of semi-related bugs exposed by
the tests for same.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196892 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/member-init-anon-union.cpp')
-rw-r--r-- | test/CodeGenCXX/member-init-anon-union.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/CodeGenCXX/member-init-anon-union.cpp b/test/CodeGenCXX/member-init-anon-union.cpp index bfe1667c8c..80db104d78 100644 --- a/test/CodeGenCXX/member-init-anon-union.cpp +++ b/test/CodeGenCXX/member-init-anon-union.cpp @@ -21,12 +21,42 @@ int g() { int a; int b = 81; }; - // CHECK: define {{.*}}_Z1gv + // CHECK-LABEL: define {{.*}}_Z1gv // CHECK-NOT: } // CHECK: call {{.*}}@"[[CONSTRUCT_LOCAL:.*]]C1Ev" return b; } +struct A { + A(); +}; +union B { + int k; + struct { + A x; + int y = 123; + }; + B() {} + B(int n) : k(n) {} +}; + +B b1; +B b2(0); + + +// CHECK-LABEL: define {{.*}} @_ZN1BC2Ei( +// CHECK-NOT: call void @_ZN1AC1Ev( +// CHECK-NOT: store i32 123, +// CHECK: store i32 % +// CHECK-NOT: call void @_ZN1AC1Ev( +// CHECK-NOT: store i32 123, +// CHECK: } + +// CHECK-LABEL: define {{.*}} @_ZN1BC2Ev( +// CHECK: call void @_ZN1AC1Ev( +// CHECK: store i32 123, +// CHECK: } + // CHECK: define {{.*}}@"[[CONSTRUCT_LOCAL]]C2Ev" // CHECK-NOT: } |