From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32444 invoked by alias); 1 Aug 2005 10:50:24 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 32424 invoked by uid 22791); 1 Aug 2005 10:50:20 -0000 Received: from kitt.34sp.com (HELO kitt.34sp.com) (217.163.9.141) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 01 Aug 2005 10:50:20 +0000 Received: (qmail 79327 invoked from network); 1 Aug 2005 10:50:17 -0000 Received: from localhost.34sp.com (HELO localhost) (127.0.0.1) by localhost.34sp.com with SMTP; 1 Aug 2005 10:50:17 -0000 Received: from 62.253.198.200 ([62.253.198.200]) by webmail.vw1600e.org.uk (IMP) with HTTP for ; Mon, 1 Aug 2005 11:50:17 +0100 Message-ID: <1122893417.42edfe69a7236@webmail.vw1600e.org.uk> Date: Mon, 01 Aug 2005 10:50:00 -0000 From: Matthew Jones To: gcc-help@gcc.gnu.org Subject: Warning about overrides hiding base class methods ? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-SW-Source: 2005-08/txt/msg00006.txt.bz2 I am getting an odd error from gcc 3.4.3. The example code below generates the following error: main.cpp:6: warning: `virtual void A::fn(float&)' was hidden main.cpp:19: warning: by `virtual void Y::fn(int&)' Why ? A::fn(float) should not be hidden, because Y::fn(int) and its inherited Y::fn(float) have different signatures. If Y had a non-virtual fn(float), that *would* hide the A::fn(float) but not A::fn(int). I know that usually gcc warnings have a very good explanation behind them, but this time I can't see what it is trying to tell me. Can someone explain ?! TIA. ---- code ---- class A { public: virtual void fn(int &) {} virtual void fn(float &) {} }; class X : public A { public: virtual void fn(int &) {} virtual void fn(float &) {} }; class Y : public A { public: virtual void fn(int &) {} }; ---- end of code ---- -- Matthew JONES http://www.tandbergtv.com/