public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: andreas@pietzowski.de
To: gcc-gnats@gcc.gnu.org
Subject: c++/8912: gcc-3 compiles things that should be syntax errors
Date: Thu, 12 Dec 2002 01:46:00 -0000	[thread overview]
Message-ID: <20021212094014.14680.qmail@sources.redhat.com> (raw)


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


             reply	other threads:[~2002-12-12  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-12  1:46 andreas [this message]
2002-12-12  2:42 reichelt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021212094014.14680.qmail@sources.redhat.com \
    --to=andreas@pietzowski.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).