objc++ arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise
matching types are not. This fixes the objc++ side only *auch*.
// rdar://10187884

llvm-svn: 140717
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 07091e6..63d4f5a 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -2074,6 +2074,23 @@
        // Argument types are too different. Abort.
        return false;
    }
+   if (LangOpts.ObjCAutoRefCount) {
+     if (FromFunctionType->hasAnyConsumedArgs() != 
+         ToFunctionType->hasAnyConsumedArgs())
+      return false;
+     FunctionProtoType::ExtProtoInfo FromEPI = 
+      FromFunctionType->getExtProtoInfo();
+     FunctionProtoType::ExtProtoInfo ToEPI = 
+      ToFunctionType->getExtProtoInfo();
+     if (FromEPI.ConsumedArguments && ToEPI.ConsumedArguments)
+       for (unsigned ArgIdx = 0, NumArgs = FromFunctionType->getNumArgs();
+            ArgIdx != NumArgs; ++ArgIdx)  {
+         if (FromEPI.ConsumedArguments[ArgIdx] != 
+             ToEPI.ConsumedArguments[ArgIdx])
+           return false;
+       }
+   }
+   
    ConvertedType = ToType;
    return true;
 }