Recommit r148056 with fixes to deal with weirdness with bitfields in unions.

Original message: Make sure adding a field to a struct never reduces its size.  PR11745.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148070 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/empty-class-layout.cpp b/test/SemaCXX/empty-class-layout.cpp
index 0b46bf0..c68f2bb 100644
--- a/test/SemaCXX/empty-class-layout.cpp
+++ b/test/SemaCXX/empty-class-layout.cpp
@@ -144,3 +144,14 @@
 SA(0, sizeof(B) == 16);
 
 }
+
+namespace Test7 {
+  // Make sure we reserve enough space for both bases; PR11745.
+  struct Empty { };
+  struct Base1 : Empty { };
+  struct Base2 : Empty { };
+  struct Test : Base1, Base2 {
+    char c;
+  };
+  SA(0, sizeof(Test) == 2);
+}