<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 9, 2014 at 1:31 PM, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">================<br>
Comment at: lib/Parse/ParseDecl.cpp:4841<br>
@@ -4824,3 +4840,3 @@<br>
     // portion is empty), if an abstract-declarator is allowed.<br>
     D.SetIdentifier(0, Tok.getLocation());<br>
<br>
----------------<br>
</div><div class="">Richard Smith wrote:<br>
> This looks like it'll provide the wrong location if there were misplaced brackets.<br>
</div>The recovery for brackets requires !D.mayOmitIdentifier() [line 4710] while this branch requires D.mayOmitIdentifier().  Either bracket recovery happens or this code executes, but not both.<br>
<div class=""><br>
================<br>
Comment at: lib/Parse/ParseDecl.cpp:4862<br>
@@ -4838,3 +4861,3 @@<br>
                                         : D.getDeclSpec().getSourceRange());<br>
-    else if (getLangOpts().CPlusPlus) {<br>
-      if (Tok.is(tok::period) || Tok.is(tok::arrow))<br>
+    } else if (getLangOpts().CPlusPlus) {<br>
+      if (!UnhandledError && (Tok.is(tok::period) || Tok.is(tok::arrow)))<br>
----------------<br>
</div><div class="">Richard Smith wrote:<br>
> Have you considered putting the bracket parsing code way down here (and recursively calling back into this function after parsing them)?<br>
</div>Currently, the error correction of:<br>
  int [1] a [2];<br>
to<br>
  int a[1][2];<br>
<br>
If this was done recursively, the bracket recovery would go to the end instead to:<br>
  int a[2][1];</blockquote><div><br></div><div>I think the latter is the right answer. If we think of</div><div><br></div><div>  int [1] a [2];</div><div><br></div><div>... as meaning</div><div><br></div><div>  T a[2]; with T = int[1]<br>
</div><div><br></div><div>... then that's the same as</div><div><br></div><div>  int a[2][1];</div></div></div></div>