Fix <rdar://problem/7100524> regression: "error: incompatible operand types ('void *' and 'NSString *')".

Remove XFAIL from 'conditional-expr-4.m' test case (which would have caught this).
Also tweaked several aspects of the test to jive with the current type checking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77453 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 9114c0b..dd5bfc4 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3206,6 +3206,25 @@
     ImpCastExprToType(RHS, compositeType);
     return compositeType;
   }
+  // Check Objective-C object pointer types and 'void *'
+  if (LHSTy->isVoidPointerType() && RHSTy->isObjCObjectPointerType()) {
+    QualType lhptee = LHSTy->getAsPointerType()->getPointeeType();
+    QualType rhptee = RHSTy->getAsObjCObjectPointerType()->getPointeeType();
+    QualType destPointee = lhptee.getQualifiedType(rhptee.getCVRQualifiers());
+    QualType destType = Context.getPointerType(destPointee);
+    ImpCastExprToType(LHS, destType); // add qualifiers if necessary
+    ImpCastExprToType(RHS, destType); // promote to void*
+    return destType;
+  }
+  if (LHSTy->isObjCObjectPointerType() && RHSTy->isVoidPointerType()) {
+    QualType lhptee = LHSTy->getAsObjCObjectPointerType()->getPointeeType();
+    QualType rhptee = RHSTy->getAsPointerType()->getPointeeType();
+    QualType destPointee = rhptee.getQualifiedType(lhptee.getCVRQualifiers());
+    QualType destType = Context.getPointerType(destPointee);
+    ImpCastExprToType(RHS, destType); // add qualifiers if necessary
+    ImpCastExprToType(LHS, destType); // promote to void*
+    return destType;
+  }
   // Check constraints for C object pointers types (C99 6.5.15p3,6).
   if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
     // get the "pointed to" types