Fix parsing of template classes prefixed by nested-name-specifiers
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67685 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 81685eb..a6e7d52 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -497,7 +497,20 @@
goto DoneWithDeclSpec;
// We are looking for a qualified typename.
- if (NextToken().isNot(tok::identifier))
+ Token Next = NextToken();
+ if (Next.is(tok::annot_template_id) &&
+ static_cast<TemplateIdAnnotation *>(Next.getAnnotationValue())
+ ->Kind == TNK_Class_template) {
+ // We have a qualified template-id, e.g., N::A<int>
+ CXXScopeSpec SS;
+ ParseOptionalCXXScopeSpecifier(SS);
+ assert(Tok.is(tok::annot_template_id) &&
+ "ParseOptionalCXXScopeSpecifier not working");
+ AnnotateTemplateIdTokenAsType(&SS);
+ continue;
+ }
+
+ if (Next.isNot(tok::identifier))
goto DoneWithDeclSpec;
CXXScopeSpec SS;
@@ -512,7 +525,6 @@
GetLookAheadToken(2).is(tok::l_paren))
goto DoneWithDeclSpec;
- Token Next = NextToken();
TypeTy *TypeRep = Actions.getTypeName(*Next.getIdentifierInfo(),
Next.getLocation(), CurScope, &SS);