public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9791: -Woverloaded-virtual reports hiding of destructor
@ 2003-02-21 18:06 georgeh
  0 siblings, 0 replies; only message in thread
From: georgeh @ 2003-02-21 18:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9791
>Category:       c++
>Synopsis:       -Woverloaded-virtual reports hiding of destructor
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 21 18:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     George Heintzelman
>Release:        gcc-3.2.2
>Organization:
>Environment:
Solaris 8
>Description:
class Base {
public:
  virtual ~Base() { 
  }
};

class Derived: public Base {
public:
  int Base() { 
    return 5;
  }
};

int main() {
}

When compiled with -Woverloaded-virtual, this file produces:
../gcc-3.2.2/bin/g++ test-hiding.C -save-temps -Wall -Woverloaded-virtual
test-hiding.C:3: warning: `virtual Base::~Base()' was hidden
test-hiding.C:9: warning:   by `int Derived::Base()'

which is certainly not accurate. It is true that int Derived::Base() is hiding the name of the base class inside the class, but this is not the kind of name-hiding that (I think) the warning was intended to guard against; nor is it name-hiding that is likely to lead to an error. I think -Woverloaded-virtual should not give a warning in this case.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-21 18:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-21 18:06 c++/9791: -Woverloaded-virtual reports hiding of destructor georgeh

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).