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]

Confirmed template parsing bug: bug in error message generation.


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|


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