public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8912: gcc-3 compiles things that should be syntax errors
@ 2002-12-12  2:42 reichelt
  0 siblings, 0 replies; 2+ messages in thread
From: reichelt @ 2002-12-12  2:42 UTC (permalink / raw)
  To: andreas, gcc-bugs, gcc-prs, nobody

Synopsis: gcc-3 compiles things that should be syntax errors

State-Changed-From-To: open->analyzed
State-Changed-By: reichelt
State-Changed-When: Thu Dec 12 02:42:54 2002
State-Changed-Why:
    Confirmed.
    gcc does so since at least gcc 2.95.x.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8912


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/8912: gcc-3 compiles things that should be syntax errors
@ 2002-12-12  1:46 andreas
  0 siblings, 0 replies; 2+ messages in thread
From: andreas @ 2002-12-12  1:46 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-12 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-12  2:42 c++/8912: gcc-3 compiles things that should be syntax errors reichelt
  -- strict thread matches above, loose matches on Subject: below --
2002-12-12  1:46 andreas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).