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);
namespace missing_typename {
-template <class T1, class T2> struct pair {}; // expected-note 5 {{template parameter is declared here}}
+template <class T1, class T2> struct pair {}; // expected-note 7 {{template parameter is declared here}}
template <class T1, class T2>
struct map {
struct ExampleItemSet {
typedef ExampleItem* iterator;
+ ExampleItem* operator[](unsigned);
};
void foo() {
pair<ExampleItemSet::iterator, int> i; // expected-error {{template argument for template type parameter must be a type; did you forget 'typename'?}}
+ pair<this->ExampleItemSet::iterator, int> i; // expected-error-re {{template argument for template type parameter must be a type$}}
+ pair<ExampleItemSet::operator[], int> i; // expected-error-re {{template argument for template type parameter must be a type$}}
}
pair<ExampleItemSet::iterator, int> elt; // expected-error {{template argument for template type parameter must be a type; did you forget 'typename'?}}