Correctly handle elaborated template ids. Still not handled properly for friends.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80977 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index f50147c..5935953 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -606,7 +606,7 @@
// to turn that template-id into a type.
bool Owned = false;
- if (TemplateId && TUK != Action::TUK_Reference && TUK != Action::TUK_Friend) {
+ if (TemplateId) {
// Explicit specialization, class template partial specialization,
// or explicit instantiation.
ASTTemplateArgsPtr TemplateArgsPtr(Actions,
@@ -629,6 +629,31 @@
TemplateId->getTemplateArgLocations(),
TemplateId->RAngleLoc,
Attr);
+ } else if (TUK == Action::TUK_Reference || TUK == Action::TUK_Friend) {
+ Action::TypeResult TypeResult =
+ Actions.ActOnTemplateIdType(TemplateTy::make(TemplateId->Template),
+ TemplateId->TemplateNameLoc,
+ TemplateId->LAngleLoc,
+ TemplateArgsPtr,
+ TemplateId->getTemplateArgLocations(),
+ TemplateId->RAngleLoc,
+ TagType, StartLoc);
+
+ TemplateId->Destroy();
+
+ if (TypeResult.isInvalid()) {
+ DS.SetTypeSpecError();
+ return;
+ }
+
+ const char *PrevSpec = 0;
+ unsigned DiagID;
+ if (DS.SetTypeSpecType(DeclSpec::TST_typename, StartLoc, PrevSpec,
+ DiagID, TypeResult.get()))
+ Diag(StartLoc, DiagID) << PrevSpec;
+
+ return;
+
} else {
// This is an explicit specialization or a class template
// partial specialization.