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. Release: gcc-3.2.2 Environment: Solaris 8
Fix: http://gcc.gnu.org/ml/gcc-patches/2003-03/msg00548.html
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed. The warning message is also not particularly useful, although it is probably arguable whether such a programming style is useful in itself :-) It used to work in 2.95, but was broken in 3.0 already. Still broken in 3.2.2, 3.3, 3.4. W.
From: mmitchel@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/9791 Date: 6 Mar 2003 20:06:30 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-03-06 20:06:30 Modified files: gcc/cp : ChangeLog class.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/warn: Woverloaded-1.C Log message: PR c++/9791 * class.c (get_basefndecls): Use lookup_fnfields_1. PR c++/9791 * g++.dg/warn/Woverloaded-1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3238&r2=1.3239 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.525&r2=1.526 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2472&r2=1.2473 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Woverloaded-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
From: mmitchel@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c++/9791 Date: 6 Mar 2003 20:08:30 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-03-06 20:08:30 Modified files: gcc/cp : ChangeLog class.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/warn: Woverloaded-1.C Log message: PR c++/9791 * class.c (get_basefndecls): Use lookup_fnfields_1. PR c++/9791 * g++.dg/warn/Woverloaded-1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.57&r2=1.3076.2.58 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.499.2.7&r2=1.499.2.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.72&r2=1.2261.2.73 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Woverloaded-1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
State-Changed-From-To: analyzed->open State-Changed-Why: Fixed in GCC 3.3.
State-Changed-From-To: open->analyzed State-Changed-Why: Remains analyzed, despite fixed for 3.3 and mainline.
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed for 3.3.