aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-11-15 01:35:18 +0000
committerJohn McCall <rjmccall@apple.com>2011-11-15 01:35:18 +0000
commit32509f1e60451d86e9fbc473b6e853ba10b5fd1e (patch)
treefb5508ad78d02b807ee47b267d03ec278ad4cead /lib/Sema/SemaTemplateDeduction.cpp
parent02ae32ae110eeb1ef785bf5ad9cdce1c001a5fa1 (diff)
Resolve placeholder expressions before trying to deduce
'auto'. Introduce a convenience method to make this a bit easier, and use it elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 93ea89d628..17987da16a 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -3342,8 +3342,14 @@ namespace {
///
/// \returns true if deduction succeeded, false if it failed.
bool
-Sema::DeduceAutoType(TypeSourceInfo *Type, Expr *Init,
+Sema::DeduceAutoType(TypeSourceInfo *Type, Expr *&Init,
TypeSourceInfo *&Result) {
+ if (Init->getType()->isNonOverloadPlaceholderType()) {
+ ExprResult result = CheckPlaceholderExpr(Init);
+ if (result.isInvalid()) return false;
+ Init = result.take();
+ }
+
if (Init->isTypeDependent()) {
Result = Type;
return true;