This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9791: -Woverloaded-virtual reports hiding of destructor
- From: georgeh at aya dot yale dot edu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 21 Feb 2003 18:05:49 -0000
- Subject: c++/9791: -Woverloaded-virtual reports hiding of destructor
- Reply-to: georgeh at aya dot yale dot edu
>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: