diff options
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index dccb4b6a61..9cfd9c31e5 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -2453,22 +2453,20 @@ bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, NameInfo = ArgExpr->getNameInfo(); } else if (CXXDependentScopeMemberExpr *ArgExpr = dyn_cast<CXXDependentScopeMemberExpr>(Arg.getAsExpr())) { - SS.Adopt(ArgExpr->getQualifierLoc()); - NameInfo = ArgExpr->getMemberNameInfo(); + if (ArgExpr->isImplicitAccess()) { + SS.Adopt(ArgExpr->getQualifierLoc()); + NameInfo = ArgExpr->getMemberNameInfo(); + } } - if (NameInfo.getName()) { + if (NameInfo.getName().isIdentifier()) { LookupResult Result(*this, NameInfo, LookupOrdinaryName); LookupParsedName(Result, CurScope, &SS); - bool CouldBeType = Result.getResultKind() == - LookupResult::NotFoundInCurrentInstantiation; - - for (LookupResult::iterator I = Result.begin(), IEnd = Result.end(); - !CouldBeType && I != IEnd; ++I) { - CouldBeType = isa<TypeDecl>(*I); - } - if (CouldBeType) { + if (Result.getAsSingle<TypeDecl>() || + Result.getResultKind() == + LookupResult::NotFoundInCurrentInstantiation) { + // FIXME: Add a FixIt and fix up the template argument for recovery. SourceLocation Loc = AL.getSourceRange().getBegin(); Diag(Loc, diag::err_template_arg_must_be_type_suggest); Diag(Param->getLocation(), diag::note_template_param_here); |