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

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 6 15:55:16 PDT 2018


vsapsai updated this revision to Diff 141448.
vsapsai added a comment.

- Add a comment.


https://reviews.llvm.org/D44449

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


Index: clang/test/Parser/cxx-decl.cpp
===================================================================
--- clang/test/Parser/cxx-decl.cpp
+++ clang/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: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -3799,7 +3799,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.141448.patch
Type: text/x-patch
Size: 1009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180406/7ca9dcef/attachment.bin>


More information about the cfe-commits mailing list