This is the mail archive of the gcc-bugs@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]

Re: egcs 1.1.2 bug (fwd)


> Anyway, here is a probable bug, for your pleasure! (MSVC and many
> other compilers accept this - I didn't look at the official grammar all
> the same).
> 
> class x
> {
> };
> 
> int
> a()
> {
>     throw(x()); // This won't compile.
>     //throw x(); // This will
> }

Yes, this is a known bug. Unfortunately, it is very hard to fix
(AFAIK).  Anybody attempting to fix this and similar bugs could just
as well rewrite the parser from scratch - which would be a good thing
to do.

In short, the problem is that g++ thinks that x() is part of a cast
expression, and then sees the closing parenthesis, which means that
the expression is missing.

Regards,
Martin


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