Improve template argument deduction in the case where the parameter
type is a template-id (e.g., basic_ostream<CharT, Traits>) and the
argument type is a class that has a derived class matching the
parameter type. Previously, we were giving up on template argument
deduction too early.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83177 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 64b7f8b..b981389 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -651,8 +651,7 @@
         = DeduceTemplateArguments(Context, TemplateParams, SpecParam, Arg,
                                   Info, Deduced);
 
-      if (Result && (TDF & TDF_DerivedClass) &&
-          Result != Sema::TDK_Inconsistent) {
+      if (Result && (TDF & TDF_DerivedClass)) {
         // C++ [temp.deduct.call]p3b3:
         //   If P is a class, and P has the form template-id, then A can be a
         //   derived class of the deduced A. Likewise, if P is a pointer to a
@@ -690,11 +689,6 @@
               // note that we had some success.
               if (BaseResult == Sema::TDK_Success)
                 Successful = true;
-              // If deduction against this base resulted in an inconsistent
-              // set of deduced template arguments, template argument
-              // deduction fails.
-              else if (BaseResult == Sema::TDK_Inconsistent)
-                return BaseResult;
             }
 
             // Visit base classes