Address comments from Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73077 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index fe779eb..1789ba7 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -276,7 +276,17 @@
       
       const FunctionProtoType *FunctionProtoParam = 
         cast<FunctionProtoType>(Param);
+
+      if (FunctionProtoParam->getTypeQuals() != 
+          FunctionProtoArg->getTypeQuals())
+        return false;
       
+      if (FunctionProtoParam->getNumArgs() != FunctionProtoArg->getNumArgs())
+        return false;
+      
+      if (FunctionProtoParam->isVariadic() != FunctionProtoArg->isVariadic())
+        return false;
+
       // Check return types.
       if (!DeduceTemplateArguments(Context,
                                    FunctionProtoParam->getResultType(),
@@ -284,9 +294,6 @@
                                    Deduced))
         return false;
       
-      if (FunctionProtoParam->getNumArgs() != FunctionProtoArg->getNumArgs())
-        return false;
-      
       for (unsigned I = 0, N = FunctionProtoParam->getNumArgs(); I != N; ++I) {
         // Check argument types.
         if (!DeduceTemplateArguments(Context,