This is the mail archive of the
mailing list for the GCC project.
Re: PR c++/26997 g++ reports misleading error message when the identifier with error occurs earlier on the same line
Manuel López-Ibáñez wrote:
>> I think the idea here is somewhat ugly, but I'm not sure how to do better.
> Ugly? Why? In fact, not avoiding tentative parsing is what makes C++
> parsing diagnostics so horrible and debugging it so much pain and
I have no particular love of tentative parsing. It's necessary in some
cases (given that C++ requires unbounded lookahead in pathological
cases), but you're absolutely right that if we can use it less, that's a
good thing. My first priority with the new parser was to make it
correct (in contrast to the old parser, which got confused by various
things), but that's not to say that it can't be tightened up.
What I found a bit conceptually ugly here was that we're depending on
the type possibly casted-to, rather than some syntactic property. It
means, for example, that we'll handle:
typedef void T();
... (T)x ...
typedef void *T;
... (T)x ...
In other words, we're not noticing the form "T()" but rather the fact
that it happens to be a FUNCTION_TYPE.
> I will replace the goto with a flag and resubmit.
(650) 331-3385 x713