This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: egcs 1.1.2 bug (fwd)
- To: hjl at lucon dot org
- Subject: Re: egcs 1.1.2 bug (fwd)
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Thu, 18 Mar 1999 00:04:28 +0100
- CC: egcs-bugs at egcs dot cygnus dot com
- References: <m10NIGI-000ErMC@ocean.lucon.org>
> 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