This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
syntax error not detected
- To: gcc-bugs at gcc dot gnu dot org
- Subject: syntax error not detected
- From: Daniel Hempel <hempel at zib dot de>
- Date: Thu, 8 Jun 2000 11:08:29 +0200 (CEST)
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