From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4978 invoked by alias); 18 Aug 2005 14:10:36 -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 4801 invoked by uid 22791); 18 Aug 2005 14:10:25 -0000 Received: from kitt.34sp.com (HELO kitt.34sp.com) (217.163.9.141) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 18 Aug 2005 14:10:25 +0000 Received: (qmail 9834 invoked from network); 18 Aug 2005 14:10:23 -0000 Received: from localhost.34sp.com (HELO localhost) (127.0.0.1) by localhost.34sp.com with SMTP; 18 Aug 2005 14:10:23 -0000 Received: from 62.253.198.200 ([62.253.198.200]) by webmail.vw1600e.org.uk (IMP) with HTTP for ; Thu, 18 Aug 2005 15:10:23 +0100 Message-ID: <1124374223.430496cf8ebe4@webmail.vw1600e.org.uk> Date: Thu, 18 Aug 2005 14:10:00 -0000 From: Matthew Jones To: gcc-help@gcc.gnu.org Subject: -Woverloaded-virtual : why ? 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/msg00178.txt.bz2 Why does the following code generate an error ? This error is described in the gcc manual under the C++ -Woverloaded-virtual flag. I can't see why gcc can't generate a call to A::f(Y). This exactly against the behaviour one would expect under the basic principles of polymorphism. (gcc 3.4.3). struct X{}; struct Y{}; struct Z{}; struct A { virtual void f(X); virtual void f(Y); virtual void f(Z); }; struct B: public A { virtual void f(X); }; void Test (void) { B b; X x; Y y; b.f(x); b.f(y); // error: no matching function for call to 'B::f(Y&)' } -- Matthew JONES http://www.tandbergtv.com/