C++ parsing bug in g++ version 2.9-ia64-000216

Randolph Chung randolph@tausq.org
Sat Apr 8 23:49:00 GMT 2000


samwise[23:37] ~% ia64-linux-g++ -v
Reading specs from
/usr/cygnus/ia64-000216/H-i686-pc-linux-gnu/lib/gcc-lib/ia64-linux/2.9-ia64-000216/specs
gcc version 2.9-ia64-000216

(this is a cross-compiler, but the bug has also been reproduced on a native
compiler)

Cross compiler machine is a ix86 Linux box (kernel 2.2.14 SMP)
Native compiler machine is a ia64 Linux box (kernel 2.3.47)

The following C++ program is not parsed correctly by this g++ snapshot.

class X {
public:
  enum Foo { 
    a, b, c, d, e = 500
  };

  char *Foo;

  int DoFoo() { return Foo[10]; }
};

int main(int, char **)
{
  X foo;
  return foo.DoFoo();
}

samwise[23:39] ~% ia64-linux-g++ -o foo foo.cc
foo.cc: In method int X::DoFoo ()':
foo.cc:9: invalid use of type decl enum X::Foo' as expression
foo.cc:9: invalid types X::Foo[int]' for array subscript

It seems like the variable and enum namespaces are getting mixed up.
Previous versions of g++ compiles the above code fine.

This bug may not be ia64 specific; i just noticed it when i was trying to
port something. The compiler was built with no special options.

Please cc me on replies to the list; thanks.

randolph
-- 
   @..@                                         http://www.TauSq.org/
  (----)
 ( >__< )
 ^^ ~~ ^^


More information about the Gcc-bugs mailing list