[PATCH] Improve error recovery around colon.

Richard Smith richard at metafoo.co.uk
Tue Jul 8 10:49:57 PDT 2014


Looks great, thanks!

================
Comment at: lib/Parse/ParseDecl.cpp:4531-4534
@@ -4531,4 +4530,6 @@
   if (getLangOpts().CPlusPlus &&
-      (Tok.is(tok::coloncolon) || Tok.is(tok::identifier) ||
-       Tok.is(tok::annot_cxxscope))) {
+      (Tok.is(tok::coloncolon) ||
+      (Tok.is(tok::identifier) && (NextToken().is(tok::coloncolon) ||
+                                   NextToken().is(tok::less))) ||
+      Tok.is(tok::annot_cxxscope))) {
     bool EnteringContext = D.getContext() == Declarator::FileContext ||
----------------
Please reindent this to make the precedence more obvious (or clang-format it). [Last 3 lines should be one space further to the right.]

http://reviews.llvm.org/D3653






More information about the cfe-commits mailing list