Internal compiler error and false parse error with class-local typedef

Greg Badros gjb@cs.washington.edu
Sun Sep 6 13:38:00 GMT 1998


When I compile the below code with:

g++ -pedantic -c bug.cc

I get:

bug.cc: In method `T ClGenericLinearExpression<T>::coefficientFor(const class ClAbstractVariable &) const':
bug.cc:15: parse error before `='


If I do:

g++ -DCRASH -c bug.cc

I get:
bug.cc:11: Internal compiler error.
bug.cc:11: Please submit a full bug report to `egcs-bugs@cygnus.com'.


The former bug concerns me more, since I think the code with the forward 
declaration and typedef is correct (it certainly used to work w/
egcs-1.0 through egcs-1.03a).

More information follows the file -- please let me know if you can't
reproduce this and need more info.

Thanks!
Greg


Here's bug.cc:
----- begin bug.cc -------------------------------------------
#include <map>

#ifndef CRASH
class ClAbstractVariable;
typedef const ClAbstractVariable *PconstClAbstractVariable;
#endif

template <class T>
class ClGenericLinearExpression  {
 public:
  typedef map<PconstClAbstractVariable,T> ClVarToCoeffMap;

  T coefficientFor(const ClAbstractVariable &var) const
    { 
    ClVarToCoeffMap::const_iterator it = _terms.find(&var);
    }
};
---- end bug.cc --------------------------------------------


More information:

% g++ -v
Reading specs from /uns/egcs-1.1b/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

configured with
./configure --enable-shared --prefix=/uns/share/egcs-1.1b --exec-prefix=/uns/egcs-1.1b

% uname -a
Linux uni.cs.washington.edu 2.0.33 #16 Wed Jun 10 16:18:20 PDT 1998 i686 unknown




More information about the Gcc-bugs mailing list