[gnu.g++.bug] g++ hash problems with typedefs and parameters

schmidt%siam.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") (01/04/89)

Hi,

   The following demonstrates a ``bug'' with g++ 1.32 ( I'm not sure if this
is a bug or a feature! ).

   The code below is derived from the AT&T 1.2.1 cfront source code ( it
obviously compiles with cfront ;-) ).  

----------------------------------------
typedef class expr * Pexpr;
typedef class vec * Pvec;

Pexpr cdvec ( Pexpr vec );
----------------------------------------

However, g++ 1.32 doesn't like it:

----------------------------------------
g++ version 1.32.0

 /usr/public/lib/g++/gcc-cpp -+ -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix foo.c /tmp/cca24119.cpp

GNU CPP version 1.32

 /usr/public/lib/g++/gcc-c++ /tmp/cca24119.cpp -quiet -dumpbase foo.c
-fstrength-reduce -finline-functions -fmemoize-lookups -fsave-memoized
-fchar-charconst -version -o /tmp/cca24119.s

GNU C++ version 1.32.0 (sparc) compiled by GNU C version 1.32.
foo.c:4: parse error before `vec'
----------------------------------------

Apparently, g++ thinks the parameter ``vec'' refers to a shorthand for
the typedefed ``class vec.''  This is not unreasonable behavior, but
it doesn't seem compatible with the AT&T version.

Doug