This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8912: gcc-3 compiles things that should be syntax errors
- From: andreas at pietzowski dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 12 Dec 2002 09:40:14 -0000
- Subject: c++/8912: gcc-3 compiles things that should be syntax errors
- Reply-to: andreas at pietzowski dot de
>Number: 8912
>Category: c++
>Synopsis: gcc-3 compiles things that should be syntax errors
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Thu Dec 12 01:46:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Andreas Pietzowski
>Release: gcc 3.2
>Organization:
>Environment:
SuSE-Linux-8.1
>Description:
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
}
>How-To-Repeat:
g++ -c classname.cpp
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: