This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Confirmed template parsing bug: bug in error message generation.
- To: egcs at egcs dot cygnus dot com, egcs-bugs at egcs dot cygnus dot com
- Subject: Confirmed template parsing bug: bug in error message generation.
- From: Paul Derbyshire <pderbysh at usa dot net>
- Date: Sun, 28 Feb 1999 00:38:31 -0500
At 07:07 PM 2/27/99 PST, I wrote:
> So there are only two possibilities:
> 1. A Mandelbug that causes the compiler to barf on legitimate
> template instance names under unspecified and complex
> circumstances. Or,
> 2. A bug that causes it to output a bogus parse error message instead
> of a real undeclared name error message under unspecified and
> complex conditions.
> Either of these is a parser bug, one in parsing itself and one in the >
generating of the correct error message for an error.
Well, I checked and it seems in my original code, I forgot to import
math_traits from a namespace. So there are actually 2 errors, which was the
cause of the confusion:
Error #1, in my code, missing using declaration causing math_traits
to not be in scope, setting me up to be dinged by:
Error #2, in egcs, wrong error message is output. Further testing
reveals that
extern foo<int> baz;
and the like will produce bogus parse errors instead of
the correct error, which is that the name 'foo' is
undeclared.
(Copy the above line and paste it into a blank text docuemnt and save as
foo.cc, and type gcc foo.cc -W -Wall -Werror -O1. You get
foo.cc:1: syntax error before ';'
and the correct error is
foo.cc:1: 'foo' undeclared
foo.cc:1: (Each undeclared identifier is reported only once etc. etc.
--
.*. "Clouds are not spheres, mountains are not cones, coastlines are not
-() < circles, and bark is not smooth, nor does lightning travel in a
`*' straight line." -------------------------------------------------
-- B. Mandelbrot |http://surf.to/pgd.net
_____________________ ____|________ Paul Derbyshire pderbysh@usa.net
Programmer & Humanist|ICQ: 10423848|