summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-11-12 21:30:23 +0000
committerReid Kleckner <reid@kleckner.net>2014-11-12 21:30:23 +0000
commit081c114a6803bd516a5721ebf78d795d7d8ddc48 (patch)
tree91702caea0b7a26959dac6b203e7f1d215a728e8 /test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
parentc644bb9df91ac64abd86ce0ef0137f24a34127f0 (diff)
Fix brace init of unions with unnamed struct members
The check for unnamed members was intended to skip unnamed bitfields, but it ended up skipping unnamed structs. This lead to an assertion in IRGen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cxx1y-initializer-aggregate.cpp')
-rw-r--r--test/CodeGenCXX/cxx1y-initializer-aggregate.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp b/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
index 8bdf8633d6..098a4b945e 100644
--- a/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
+++ b/test/CodeGenCXX/cxx1y-initializer-aggregate.cpp
@@ -36,6 +36,17 @@ B y {};
B z { 1 };
// CHECK: @z = global {{.*}} { i32 1 }
+// Brace initialization should initialize the first field even though it is
+// unnamed.
+union C {
+ struct {
+ int C::*memptr;
+ };
+};
+
+C n{};
+// CHECK: @n = global %union.C { %struct.anon { i64 -1 } }, align 8
+
// Initialization of 'a':
// CHECK: store i32 0, i32* getelementptr inbounds ({{.*}} @a, i32 0, i32 0)