[cfe-commits] r105178 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/Parser/declarators.c

Douglas Gregor dgregor at apple.com
Sun May 30 15:30:22 PDT 2010


Author: dgregor
Date: Sun May 30 17:30:21 2010
New Revision: 105178

URL: http://llvm.org/viewvc/llvm-project?rev=105178&view=rev
Log:
Don't try to parse class template specializations in C. It can only
lead to heartache. Fixes <rdar://problem/8044088>.

Modified:
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/test/Parser/declarators.c

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=105178&r1=105177&r2=105178&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun May 30 17:30:21 2010
@@ -670,7 +670,7 @@
     Name = Tok.getIdentifierInfo();
     NameLoc = ConsumeToken();
 
-    if (Tok.is(tok::less)) {
+    if (Tok.is(tok::less) && getLang().CPlusPlus) {
       // The name was supposed to refer to a template, but didn't.
       // Eat the template argument list and try to continue parsing this as
       // a class (or template thereof).
@@ -713,8 +713,6 @@
         const_cast<ParsedTemplateInfo&>(TemplateInfo).ExternLoc
           = SourceLocation();
       }
-
-
     }
   } else if (Tok.is(tok::annot_template_id)) {
     TemplateId = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());

Modified: cfe/trunk/test/Parser/declarators.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/declarators.c?rev=105178&r1=105177&r2=105178&view=diff
==============================================================================
--- cfe/trunk/test/Parser/declarators.c (original)
+++ cfe/trunk/test/Parser/declarators.c Sun May 30 17:30:21 2010
@@ -83,3 +83,6 @@
 
 // rdar://7608537
 struct test13 { int a; } (test13x);
+
+// <rdar://problem/8044088>
+struct X<foo::int> { }; // expected-error{{expected identifier or '('}}





More information about the cfe-commits mailing list