[PATCH] Avoid spurious error messages if parent template class cannot be instantiated

Richard Smith richard at metafoo.co.uk
Wed Aug 7 15:24:10 PDT 2013



================
Comment at: lib/Parse/Parser.cpp:350
@@ -349,1 +349,3 @@
 
+// Skip template arguments
+bool Parser::SkipTemplateArguments() {
----------------
This comment adds nothing; please remove it.

================
Comment at: lib/Parse/Parser.cpp:373-374
@@ +372,4 @@
+      case tok::greatergreater:
+      case tok::greaterequal:
+      case tok::greatergreaterequal:
+      case tok::greatergreatergreater:
----------------
Remove the `equal` forms here and in `SpecDelimiters`. Unlike the `>>` and `>>>` tokens, `>=` and `>>=` are not automatically split if they end a template-argument-list.

================
Comment at: lib/Parse/Parser.cpp:363
@@ +362,3 @@
+
+  while (Tok.isNot(tok::eof) && Tok.isNot(tok::semi)) {
+    if (SkipUntil(SpecDelimiters, /*StopAtSemi*/true, /*DontConsume*/true)) {
----------------
If you end this loop without reaching a nesting level of 0, it would be great to revert all the tokens since the most recent `>`. For instance, that would recover correctly for:

    struct A : T<1 < 2>, T< 3 < 4> { ... };

You can handle the backtracking with a `TentativeParsingAction`.


http://llvm-reviews.chandlerc.com/D924



More information about the cfe-commits mailing list