This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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 <mark@codesourcery.com>:
> 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
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26997#c5
>
>> 2008-10-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>
>>
>>       PR c++/26997
>> cp/
>>       * parser.c (cp_parser_cast_expression): Parse definitely if we are
>>       sure this is a cast to non-function type.
>> testsuite/
>>       * 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.

Cheers,

Manuel.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]