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: [patch] fix PR c++/14136: Duplicate error message


Volker Reichelt <reichelt@igpm.rwth-aachen.de> wrote:

> For the following code snippet we issue a duplicate diagnostic on
mainline:
>
> ==========================
> struct A
> {
>     typedef A B;
>     ~B();
> };
> ==========================
>
> PR14136.cc:4: error: typedef-name 'A::B' used as destructor declarator
> PR14136.cc:4: error: typedef-name 'A::B' used as destructor declarator
>
> This is because we issue the error when we are parsing the declaration
> tentatively and then again when we parse it for real.
>
> The following patch fixes that by not issuing the error message when we
> do tentative parsing only.

I don't recall us doing a check like this to avoid error messages anywhere
else in the parser. Usually, we use cp_parser_error: in tentative parsing,
it does not emit the error message but marks the parsing attempt as failed;
in non-tenative parsing, it emits a normal error message.

So I am not sure this is the correct way to go.
-- 
Giovanni Bajo


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