Fix parsing of template classes prefixed by nested-name-specifiers

llvm-svn: 67685
This commit is contained in:
Douglas Gregor 2009-03-25 15:40:00 +00:00
parent 9106b82ceb
commit 167fa625f3
2 changed files with 22 additions and 2 deletions

View File

@ -497,7 +497,20 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
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 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
GetLookAheadToken(2).is(tok::l_paren))
goto DoneWithDeclSpec;
Token Next = NextToken();
TypeTy *TypeRep = Actions.getTypeName(*Next.getIdentifierInfo(),
Next.getLocation(), CurScope, &SS);

View File

@ -28,3 +28,11 @@ B<17 + 2> *bar(B<(19)> *ptr1, B< (::value + 7) > *ptr2, B<19 - 3> *ptr3) {
}
typedef B<5> B5;
namespace N {
template<typename T> struct C {};
}
N::C<int> c1;
typedef N::C<float> c2;