From: Douglas Gregor Date: Mon, 28 Sep 2009 07:26:33 +0000 (+0000) Subject: Parse a C++ scope specifier followed by a "typename" annotation token as a type name... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d7b35303c6f1eaee85039d0f934c456e063cd0a;p=clang Parse a C++ scope specifier followed by a "typename" annotation token as a type name within the declaration specifiers. Fixes PR5061. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82974 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 2dac473cc6..d885558e1f 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -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; diff --git a/test/SemaTemplate/qualified-id.cpp b/test/SemaTemplate/qualified-id.cpp new file mode 100644 index 0000000000..85efab2b5c --- /dev/null +++ b/test/SemaTemplate/qualified-id.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// PR5061 +namespace a { + template class C {}; +} +namespace b { + template void f0(a::C &a0) { } +}