This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/9791: -Woverloaded-virtual reports hiding of destructor


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]