[PATCH] D44449: [Parser] Fix assertion-on-invalid for unexpected typename.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 10 11:32:58 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL329735: [Parser] Fix assertion-on-invalid for unexpected typename. (authored by vsapsai, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D44449?vs=141448&id=141885#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44449

Files:
  cfe/trunk/lib/Parse/ParseDecl.cpp
  cfe/trunk/test/Parser/cxx-decl.cpp


Index: cfe/trunk/test/Parser/cxx-decl.cpp
===================================================================
--- cfe/trunk/test/Parser/cxx-decl.cpp
+++ cfe/trunk/test/Parser/cxx-decl.cpp
@@ -298,6 +298,11 @@
   }
 }
 
+namespace rdar37099386 {
+  class A typename A; // expected-error {{expected a qualified name after 'typename'}}
+  // expected-error at -1 {{cannot combine with previous 'class' declaration specifier}}
+}
+
 // PR8380
 extern ""      // expected-error {{unknown linkage language}}
 test6a { ;// expected-error {{C++ requires a type specifier for all declarations}}
Index: cfe/trunk/lib/Parse/ParseDecl.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp
+++ cfe/trunk/lib/Parse/ParseDecl.cpp
@@ -3804,7 +3804,8 @@
 
     DS.SetRangeEnd(Tok.getLocation());
     if (DiagID != diag::err_bool_redeclaration)
-      ConsumeToken();
+      // After an error the next token can be an annotation token.
+      ConsumeAnyToken();
 
     AttrsLastTime = false;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44449.141885.patch
Type: text/x-patch
Size: 1033 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180410/49f02882/attachment.bin>


More information about the cfe-commits mailing list