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
2008/10/27 Mark Mitchell <firstname.lastname@example.org>:
> Manuel López-Ibáñez wrote:
>> The patch should be self-explanatory (otherwise, it needs more
>> comments). There may be other ways to improve this. See
>> 2008-10-26 Manuel López-Ibáñez <email@example.com>
>> PR c++/26997
>> * parser.c (cp_parser_cast_expression): Parse definitely if we are
>> sure this is a cast to non-function type.
>> * g++.dg/warn/pr26997.C: New.
> 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
effort. It probably also makes the parser slower by trying to parse
things that will never be valid. I am looking forward to see a
comparison between the clang C++ parser and GCC's C++ parser. I wonder
if clang will use tentative parsing so much as we do.
I will replace the goto with a flag and resubmit.