From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12258 invoked by alias); 28 Jan 2003 18:46:00 -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 12237 invoked by uid 71); 28 Jan 2003 18:46:00 -0000 Resent-Date: 28 Jan 2003 18:46:00 -0000 Resent-Message-ID: <20030128184600.12236.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 11579 invoked from network); 28 Jan 2003 18:43:11 -0000 Received: from unknown (HELO d0sgibnl1.fnal.gov) (131.225.226.68) by 172.16.49.205 with SMTP; 28 Jan 2003 18:43:11 -0000 Received: from localhost (snyder@localhost) by d0sgibnl1.fnal.gov (SGI-8.9.3/8.9.3) with SMTP id MAA53993 for ; Tue, 28 Jan 2003 12:42:25 -0600 (CST) Message-Id: <200301281842.MAA53993@d0sgibnl1.fnal.gov> Date: Tue, 28 Jan 2003 18:46: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++/9485: g++ 3.4: wrong class's virtual function called X-SW-Source: 2003-01/txt/msg01625.txt.bz2 List-Id: >Number: 9485 >Category: c++ >Synopsis: g++ 3.4: wrong class's virtual function called >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Jan 28 18:46:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: scott snyder >Release: 3.4 20030127 (experimental) >Organization: >Environment: System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 unknown 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 >Description: This bug is perhaps related to the earlier c++/9415 that i reported; however, the fix for that one does not fix this case. In the function foofoo() in the test case below, the construction B* type; type -> A::construct (); does not call A::construct as intended; rather, it calls B::construct, as can be seen by running the program: $ g++ -o x x.cc $ ./x B $ >How-To-Repeat: ------------------------- extern "C" int printf (...); struct A { virtual void construct () { printf ("A\n"); } }; struct B : public A { virtual void construct () { printf ("B\n"); } }; void foofoo (B* type) { type -> A::construct (); } int main () { foofoo (new B); return 0; } ------------------------- >Fix: >Release-Note: >Audit-Trail: >Unformatted: