Parse a C++ scope specifier followed by a "typename" annotation token as a type name within the declaration specifiers. Fixes PR5061.

llvm-svn: 82974
This commit is contained in:
Douglas Gregor 2009-09-28 07:26:33 +00:00
parent 0261b5d2d2
commit c5790dfeb4
2 changed files with 22 additions and 0 deletions

View File

@ -778,6 +778,19 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
continue;
}
if (Next.is(tok::annot_typename)) {
// FIXME: is this scope-specifier getting dropped?
ConsumeToken(); // the scope-specifier
if (Tok.getAnnotationValue())
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_typename, Loc,
PrevSpec, DiagID,
Tok.getAnnotationValue());
else
DS.SetTypeSpecError();
DS.SetRangeEnd(Tok.getAnnotationEndLoc());
ConsumeToken(); // The typename
}
if (Next.isNot(tok::identifier))
goto DoneWithDeclSpec;

View File

@ -0,0 +1,9 @@
// RUN: clang-cc -fsyntax-only -verify %s
// PR5061
namespace a {
template <typename T> class C {};
}
namespace b {
template<typename T> void f0(a::C<T> &a0) { }
}