Extend the deduced/actual argument type checking of C++
[temp.deduct.call]p4 to the deduction performed for 'auto', finishing
the fix for PR9233.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133239 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 9612ea7..ef5a59a 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -3344,8 +3344,19 @@
QualType DeducedType = Deduced[0].getAsType();
if (DeducedType.isNull())
return false;
-
+
Result = SubstituteAutoTransform(*this, DeducedType).TransformType(Type);
+
+ // Check that the deduced argument type is compatible with the original
+ // argument type per C++ [temp.deduct.call]p4.
+ if (Result &&
+ CheckOriginalCallArgDeduction(*this,
+ Sema::OriginalCallArg(FuncParam,0,InitType),
+ Result->getType())) {
+ Result = 0;
+ return false;
+ }
+
return true;
}