Another i1 vs. i8 type mismatch issue. This time
a 'bool' byref variable in memory. Fixes radar 8382559.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112835 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 8ce196b..d4c65e3 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -373,7 +373,7 @@
   }
 
   // T x;
-  Types.push_back(ConvertType(Ty));
+  Types.push_back(ConvertTypeForMem(Ty));
   
   const llvm::Type *T = llvm::StructType::get(VMContext, Types, Packed);
   
diff --git a/test/CodeGenCXX/reference-in-blocks.cpp b/test/CodeGenCXX/reference-in-blocks.cpp
index 388ec7c..f08ef56 100644
--- a/test/CodeGenCXX/reference-in-blocks.cpp
+++ b/test/CodeGenCXX/reference-in-blocks.cpp
@@ -41,3 +41,13 @@
 	a->F();
         return 0;
 }
+
+// rdar://8382559
+namespace radar8382559 {
+  void func(bool& outHasProperty);
+
+  void test() {
+    __attribute__((__blocks__(byref))) bool hasProperty = false;
+    func(hasProperty);
+  }
+}