Template keyword should not be ignored building a QualifiedTemplateName.
llvm-svn: 110441
This commit is contained in:
parent
d26129a98a
commit
7c5dee4280
|
@ -281,6 +281,8 @@ public:
|
|||
/// \param SS the C++ nested-name-specifier that precedes the template name,
|
||||
/// if any.
|
||||
///
|
||||
/// \param hasTemplateKeyword true if the template keyword was specified.
|
||||
///
|
||||
/// \param Name the name that we are querying to determine whether it is
|
||||
/// a template.
|
||||
///
|
||||
|
@ -303,6 +305,7 @@ public:
|
|||
/// \returns the kind of template that this name refers to.
|
||||
virtual TemplateNameKind isTemplateName(Scope *S,
|
||||
CXXScopeSpec &SS,
|
||||
bool hasTemplateKeyword,
|
||||
UnqualifiedId &Name,
|
||||
TypeTy *ObjectType,
|
||||
bool EnteringContext,
|
||||
|
|
|
@ -294,6 +294,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
|||
TemplateName.setIdentifier(&II, Tok.getLocation());
|
||||
bool MemberOfUnknownSpecialization;
|
||||
if (TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS,
|
||||
/*hasTemplateKeyword=*/false,
|
||||
TemplateName,
|
||||
ObjectType,
|
||||
EnteringContext,
|
||||
|
@ -1023,8 +1024,9 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
|||
return true;
|
||||
} else {
|
||||
bool MemberOfUnknownSpecialization;
|
||||
TNK = Actions.isTemplateName(getCurScope(), SS, Id, ObjectType,
|
||||
EnteringContext, Template,
|
||||
TNK = Actions.isTemplateName(getCurScope(), SS,
|
||||
TemplateKWLoc.isValid(), Id,
|
||||
ObjectType, EnteringContext, Template,
|
||||
MemberOfUnknownSpecialization);
|
||||
|
||||
if (TNK == TNK_Non_template && MemberOfUnknownSpecialization &&
|
||||
|
@ -1059,7 +1061,8 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
|||
UnqualifiedId TemplateName;
|
||||
bool MemberOfUnknownSpecialization;
|
||||
TemplateName.setIdentifier(Name, NameLoc);
|
||||
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateName, ObjectType,
|
||||
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateKWLoc.isValid(),
|
||||
TemplateName, ObjectType,
|
||||
EnteringContext, Template,
|
||||
MemberOfUnknownSpecialization);
|
||||
break;
|
||||
|
@ -1076,7 +1079,8 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
|||
if (TNK == TNK_Non_template)
|
||||
return true;
|
||||
} else {
|
||||
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateName, ObjectType,
|
||||
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateKWLoc.isValid(),
|
||||
TemplateName, ObjectType,
|
||||
EnteringContext, Template,
|
||||
MemberOfUnknownSpecialization);
|
||||
|
||||
|
|
|
@ -928,7 +928,9 @@ ParsedTemplateArgument Parser::ParseTemplateTemplateArgument() {
|
|||
|
||||
if (isEndOfTemplateArgument(Tok)) {
|
||||
bool MemberOfUnknownSpecialization;
|
||||
TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS, Name,
|
||||
TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS,
|
||||
/*hasTemplateKeyword=*/false,
|
||||
Name,
|
||||
/*ObjectType=*/0,
|
||||
/*EnteringContext=*/false,
|
||||
Template,
|
||||
|
|
|
@ -1007,9 +1007,10 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
|
|||
TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
|
||||
bool MemberOfUnknownSpecialization;
|
||||
if (TemplateNameKind TNK
|
||||
= Actions.isTemplateName(getCurScope(), SS, TemplateName,
|
||||
/*ObjectType=*/0, EnteringContext,
|
||||
Template, MemberOfUnknownSpecialization)) {
|
||||
= Actions.isTemplateName(getCurScope(), SS,
|
||||
/*hasTemplateKeyword=*/false, TemplateName,
|
||||
/*ObjectType=*/0, EnteringContext,
|
||||
Template, MemberOfUnknownSpecialization)) {
|
||||
// Consume the identifier.
|
||||
ConsumeToken();
|
||||
if (AnnotateTemplateIdToken(Template, TNK, &SS, TemplateName)) {
|
||||
|
|
|
@ -2960,6 +2960,7 @@ public:
|
|||
|
||||
virtual TemplateNameKind isTemplateName(Scope *S,
|
||||
CXXScopeSpec &SS,
|
||||
bool hasTemplateKeyword,
|
||||
UnqualifiedId &Name,
|
||||
TypeTy *ObjectType,
|
||||
bool EnteringContext,
|
||||
|
|
|
@ -282,7 +282,8 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II,
|
|||
CXXScopeSpec EmptySS;
|
||||
TemplateTy TemplateResult;
|
||||
bool MemberOfUnknownSpecialization;
|
||||
if (isTemplateName(S, SS ? *SS : EmptySS, Name, 0, true, TemplateResult,
|
||||
if (isTemplateName(S, SS ? *SS : EmptySS, /*hasTemplateKeyword=*/false,
|
||||
Name, 0, true, TemplateResult,
|
||||
MemberOfUnknownSpecialization) == TNK_Type_template) {
|
||||
TemplateName TplName = TemplateResult.getAsVal<TemplateName>();
|
||||
Diag(IILoc, diag::err_template_missing_args) << TplName;
|
||||
|
|
|
@ -97,6 +97,7 @@ static void FilterAcceptableTemplateNames(ASTContext &C, LookupResult &R) {
|
|||
|
||||
TemplateNameKind Sema::isTemplateName(Scope *S,
|
||||
CXXScopeSpec &SS,
|
||||
bool hasTemplateKeyword,
|
||||
UnqualifiedId &Name,
|
||||
TypeTy *ObjectTypePtr,
|
||||
bool EnteringContext,
|
||||
|
@ -150,7 +151,8 @@ TemplateNameKind Sema::isTemplateName(Scope *S,
|
|||
if (SS.isSet() && !SS.isInvalid()) {
|
||||
NestedNameSpecifier *Qualifier
|
||||
= static_cast<NestedNameSpecifier *>(SS.getScopeRep());
|
||||
Template = Context.getQualifiedTemplateName(Qualifier, false, TD);
|
||||
Template = Context.getQualifiedTemplateName(Qualifier,
|
||||
hasTemplateKeyword, TD);
|
||||
} else {
|
||||
Template = TemplateName(TD);
|
||||
}
|
||||
|
@ -1681,8 +1683,8 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S,
|
|||
// "template" keyword is now permitted). We follow the C++0x
|
||||
// rules, even in C++03 mode with a warning, retroactively applying the DR.
|
||||
bool MemberOfUnknownSpecialization;
|
||||
TemplateNameKind TNK = isTemplateName(0, SS, Name, ObjectType,
|
||||
EnteringContext, Result,
|
||||
TemplateNameKind TNK = isTemplateName(0, SS, TemplateKWLoc.isValid(), Name,
|
||||
ObjectType, EnteringContext, Result,
|
||||
MemberOfUnknownSpecialization);
|
||||
if (TNK == TNK_Non_template && LookupCtx->isDependentContext() &&
|
||||
isa<CXXRecordDecl>(LookupCtx) &&
|
||||
|
|
Loading…
Reference in New Issue