syntax error not detected

Daniel Hempel hempel@zib.de
Thu Jun 8 02:09:00 GMT 2000


Hello,

here is an "illegal" c++-program, which does not cause any warning
or compilation error.

Daniel <hempel@zib.de>


Compilation:
g++ -ansi -Wall file.cc

file.cc
------------------------------------------------------------------------------
 #include <iostream.h>

 class A
 {
   A() { cout << "private default constructor (never called)\n"; }
 public:
   
   A(const A &src)
   {
     if(&src == this)
       cout << "Big bang: constructing me by myself\n";
   }
 };

 int main(void)
 {
   A a = a;
   return 0;
 }
------------------------------------------------------------------------------

gcc -v
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)

uname -a
Linux hermesbaby 2.0.35 #38 Wed Feb 10 16:11:02 CET 1999 i586 unknown


More information about the Gcc-bugs mailing list