]> granicus.if.org Git - clang/commitdiff
Parse a C++ scope specifier followed by a "typename" annotation token as a type name...
authorDouglas Gregor <dgregor@apple.com>
Mon, 28 Sep 2009 07:26:33 +0000 (07:26 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 28 Sep 2009 07:26:33 +0000 (07:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82974 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/SemaTemplate/qualified-id.cpp [new file with mode: 0644]

index 2dac473cc6c2c3a319bb9bf223429e4ff0597f98..d885558e1f383ed1b142d7886a6cf4b67ef0ace7 100644 (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;
 
diff --git a/test/SemaTemplate/qualified-id.cpp b/test/SemaTemplate/qualified-id.cpp
new file mode 100644 (file)
index 0000000..85efab2
--- /dev/null
@@ -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) { }
+}