From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18951 invoked by alias); 12 May 2003 23:16:08 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18522 invoked by uid 71); 12 May 2003 23:16:02 -0000 Resent-Date: 12 May 2003 23:16:02 -0000 Resent-Message-ID: <20030512231602.18521.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, snyder@fnal.gov Received: (qmail 8248 invoked from network); 12 May 2003 23:14:04 -0000 Received: from unknown (HELO d0mino.fnal.gov) (131.225.224.45) by sources.redhat.com with SMTP; 12 May 2003 23:14:04 -0000 Received: from d0mino.fnal.gov (localhost [127.0.0.1]) by d0mino.fnal.gov (SGI-8.12.5/8.9.3) with ESMTP id h4CNE30S18001014 for ; Mon, 12 May 2003 18:14:03 -0500 (CDT) Message-Id: <200305122314.h4CNE30S18001014@d0mino.fnal.gov> Date: Mon, 12 May 2003 23:16:00 -0000 From: snyder@fnal.gov Reply-To: snyder@fnal.gov To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: c++/10761: [3.4] wrong virtual function called X-SW-Source: 2003-05/txt/msg01388.txt.bz2 List-Id: >Number: 10761 >Category: c++ >Synopsis: [3.4] wrong virtual function called >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon May 12 23:16:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: scott snyder >Release: 3.4 20030512 (experimental) >Organization: >Environment: System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 i686 i386 GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 : (reconfigured) >Description: Another case where we call the derived-class version of a virtual function, in the face of an explicit request to call the version in the base class. The example below goes into an infinite recursive loop: $ g++ -o x x.cc $ ./x B::foo B::foo B::foo B::foo B::foo ... >How-To-Repeat: --------------------------------------------- extern "C" int printf(...); class A { public: virtual ~A () {} virtual void foo () { printf ("A::foo\n"); } }; template class B : public A { public: virtual void foo () { printf ("B::foo\n"); this->A::foo (); } }; int main () { B b; b.foo(); return 0; } --------------------------------------------- >Fix: >Release-Note: >Audit-Trail: >Unformatted: