Instantiation bug fix extension (cf. r184503) -- minor code fixes, including a typo that caused a runtime assertion after firing diagnosis for class definitions, with the 'template' keyword as template header, in friend declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184634 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp
index e8e7efd..973eeb2 100644
--- a/lib/Parse/ParseTemplate.cpp
+++ b/lib/Parse/ParseTemplate.cpp
@@ -242,6 +242,8 @@
// If the declarator-id is not a template-id, issue a diagnostic and
// recover by ignoring the 'template' keyword.
Diag(Tok, diag::err_template_defn_explicit_instantiation) << 0;
+ return ParseFunctionDefinition(DeclaratorInfo, ParsedTemplateInfo(),
+ &LateParsedAttrs);
} else {
SourceLocation LAngleLoc
= PP.getLocForEndOfToken(TemplateInfo.TemplateLoc);
@@ -251,24 +253,21 @@
<< FixItHint::CreateInsertion(LAngleLoc, "<>");
// Recover as if it were an explicit specialization.
- TemplateParameterLists ParamLists;
- SmallVector<Decl*, 4> TemplateParams;
- ParamLists.push_back(
- TemplateParameterList::Create(Actions.getASTContext(),
- TemplateInfo.TemplateLoc,
- LAngleLoc,
- (NamedDecl**)TemplateParams.data(),
- TemplateParams.size(), LAngleLoc));
+ TemplateParameterLists FakedParamLists;
+ FakedParamLists.push_back(
+ Actions.ActOnTemplateParameterList(0, SourceLocation(),
+ TemplateInfo.TemplateLoc,
+ LAngleLoc, 0, 0, LAngleLoc));
return ParseFunctionDefinition(DeclaratorInfo,
- ParsedTemplateInfo(&ParamLists,
+ ParsedTemplateInfo(&FakedParamLists,
/*isSpecialization=*/true,
/*LastParamListWasEmpty=*/true),
&LateParsedAttrs);
}
}
return ParseFunctionDefinition(DeclaratorInfo, TemplateInfo,
- &LateParsedAttrs);
+ &LateParsedAttrs);
}
// Parse this declaration.