[cfe-commits] r82974 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/SemaTemplate/qualified-id.cpp

Douglas Gregor dgregor at apple.com
Mon Sep 28 00:26:33 PDT 2009


Author: dgregor
Date: Mon Sep 28 02:26:33 2009
New Revision: 82974

URL: http://llvm.org/viewvc/llvm-project?rev=82974&view=rev
Log:
Parse a C++ scope specifier followed by a "typename" annotation token as a type name within the declaration specifiers. Fixes PR5061.

Added:
    cfe/trunk/test/SemaTemplate/qualified-id.cpp   (with props)
Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=82974&r1=82973&r2=82974&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Sep 28 02:26:33 2009
@@ -778,6 +778,19 @@
         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;
 

Added: cfe/trunk/test/SemaTemplate/qualified-id.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/qualified-id.cpp?rev=82974&view=auto

==============================================================================
--- cfe/trunk/test/SemaTemplate/qualified-id.cpp (added)
+++ cfe/trunk/test/SemaTemplate/qualified-id.cpp Mon Sep 28 02:26:33 2009
@@ -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) { }
+}

Propchange: cfe/trunk/test/SemaTemplate/qualified-id.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/SemaTemplate/qualified-id.cpp

------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cfe/trunk/test/SemaTemplate/qualified-id.cpp

------------------------------------------------------------------------------
    svn:mime-type = text/plain





More information about the cfe-commits mailing list