This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc-3 compiles things that should be syntax errors
- From: Andreas Pietzowski <andreas at pietzowski dot de>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 11 Dec 2002 23:35:05 +0100
- Subject: gcc-3 compiles things that should be syntax errors
Hi,
sorry I tried your web-form-bug-reporter (GNATS) but it didn't accept my
posting. That's why I mail the bug to you directly:
I use gcc 3.2 on SuSE-Linux-8.1 and I found a weird behavior:
In my code I made a copy&paste mistake and the result was as follows:
void ClassName::ClassName::method(){
// do something
}
The crazy thing is that gcc compiled that file correctly (as there was only
ONE ClassName). I recognized the syntax error because the Borland-compiler
under windows exited with errors. You can add as many "ClassName::" as you
want. gcc will always compile with no errors...
The compiled program is correct but I think gcc should exit with an error on
that copy&paste mistake. What do you think? Can you reproduce the behavior?
I attached a file which showes up the effect. Just compile it wit
gcc -c classname.cpp
and watch out for errors :)
Have a nice day
Andreas
class ClassName{
public:
ClassName();
~ClassName();
void method();
};
ClassName::ClassName(){
}
ClassName::~ClassName(){
}
void ClassName::ClassName::ClassName::method(){
// do something
}