aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2011-08-05 00:09:52 +0000
committerKaelyn Uhrain <rikka@google.com>2011-08-05 00:09:52 +0000
commitace5e76e5c707f4a8447abc01ef540fa6d57ff95 (patch)
treee0d56203256c00268ccca38b9f279eb45fac9654 /lib/Sema/SemaExpr.cpp
parent1a38b46ae2f818592577546c8c800ada8de7962b (diff)
Have the typo correction in DiagnoseEmptyLookup properly handle template
functions when performing function overload resolution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index ffa092aad1..bc7d0bdfe5 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1364,8 +1364,9 @@ Sema::DecomposeUnqualifiedId(const UnqualifiedId &Id,
///
/// \return false if new lookup candidates were found
bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
- CorrectTypoContext CTC, Expr **Args,
- unsigned NumArgs) {
+ CorrectTypoContext CTC,
+ TemplateArgumentListInfo *ExplicitTemplateArgs,
+ Expr **Args, unsigned NumArgs) {
DeclarationName Name = R.getLookupName();
unsigned diagnostic = diag::err_undeclared_var_use;
@@ -1458,10 +1459,13 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
CDEnd = Corrected.end();
CD != CDEnd; ++CD) {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(*CD))
- AddOverloadCandidate(FD, DeclAccessPair::make(*CD, AS_none),
+ AddOverloadCandidate(FD, DeclAccessPair::make(FD, AS_none),
Args, NumArgs, OCS);
- // TODO: Handle FunctionTemplateDecl and other Decl types that
- // support overloading and could be corrected by CorrectTypo.
+ else if (FunctionTemplateDecl *FTD =
+ dyn_cast<FunctionTemplateDecl>(*CD))
+ AddTemplateOverloadCandidate(
+ FTD, DeclAccessPair::make(FTD, AS_none), ExplicitTemplateArgs,
+ Args, NumArgs, OCS);
}
switch (OCS.BestViableFunction(*this, R.getNameLoc(), Best)) {
case OR_Success: