zhao@wiener.usc.edu (03/20/89)
Should g++ emit warning against the bug shown in the following program? I am running g++-1.34.1 on a SUN3/60M OS4.0.1. [1]: cat bug.c class base; class base { private: base *next; public: base (void); #ifndef BUG void Insert (base* elem); #else void Insert (base*& elem); #endif }; void main (void) { base* FOO = new base (); FOO->Insert (new base()); } [2]: g++ -c -v bug.c g++ version 1.34.1 /home/wiener/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 bug.c /tmp/cca02876.cpp GNU CPP version 1.34 /home/wiener/local/lib/gcc-c++ /tmp/cca02876.cpp -quiet -dumpbase bug.c -version -o /tmp/cca02876.s GNU C++ version 1.34.1 (68k, MIT syntax) compiled by GNU C version 1.34. as -mc68020 /tmp/cca02876.s -o bug.o [3]: g++ -c -DBUG -v bug.c g++ version 1.34.1 /home/wiener/local/lib/gcc-cpp -+ -v -DBUG -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 bug.c /tmp/cca02880.cpp GNU CPP version 1.34 /home/wiener/local/lib/gcc-c++ /tmp/cca02880.cpp -quiet -dumpbase bug.c -version -o /tmp/cca02880.s GNU C++ version 1.34.1 (68k, MIT syntax) compiled by GNU C version 1.34. In function void main (): bug.c:18: Segmentation violation Program c++ got fatal signal 11.