[gnu.g++.bug] G++ 1.36.{1,2,3}

klaiber@CS.WASHINGTON.EDU (Alexander Klaiber) (01/16/90)

SUN 3, OS 3
g++ 1.36.{1,2,3}
Bombs when undeclared class name used in another class declaration.


--------- file "main.c"--------------------------------------------
class Foo {
private:
    Bar* bar;
};
--------- g++ -v main.c -------------------------------------------
g++ version 1.36.3 (based on GCC 1.36.92)
 /usr/larry/users/klaiber/lib/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 main.c /usr/tmp/cca00819.cpp
GNU CPP version 1.36
 /usr/larry/users/klaiber/lib/gcc-cc1plus /usr/tmp/cca00819.cpp -quiet -dumpbase main.c -version -o /usr/tmp/cca00819.s
GNU C++ version 1.36.3 (based on GCC 1.36.92) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
Errors detected in input file (your bison.simple is out of date) 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is the problem, the rest of the compilation obviously cannot work...
but g++ still continues into the assembly phase; compiler doesn't abort!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
as -mc68020 -o main.o /usr/tmp/cca00819.s
 /usr/larry/users/klaiber/lib/gcc-ld -e start -dc -dp /lib/crt0.o /lib/Mcrt1.o main.o -lg++ /usr/larry/users/klaiber/lib/gcc-gnulib -lc -L/usr/lib/f68881
/lib/crt0.o: Undefined symbol _main referenced from text segment


--------------------------------------------------------------------
I've had this problem with g++ 1.36.{1,2,3}  --  sorry for not reporting 
it earlier; I thought this was already being taken care of in 1.36.2.

Adding the right declaration helps; the following compiles fine.
--------- file "okay.c"--------------------------------------------
class Bar;
class Foo {
private:
    Bar* bar;
};
--------------------------------------------------------------------

This can be rather annoying if many "class" declarations are needed, since
no line number is indicated...


	Alex