From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24985 invoked by alias); 21 Jan 2003 21:36:01 -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 24966 invoked by uid 71); 21 Jan 2003 21:36:01 -0000 Date: Tue, 21 Jan 2003 21:36:00 -0000 Message-ID: <20030121213601.24965.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/9377: g++ 64bit calls wrong function -> Multi-inheritance: pointer to member function of the 2nd base calss points to wrong place Reply-To: Wolfgang Bangerth X-SW-Source: 2003-01/txt/msg01169.txt.bz2 List-Id: The following reply was made to PR c++/9377; it has been noted by GNATS. From: Wolfgang Bangerth To: Andrew Xiong Cc: bangerth@dealii.org, , Subject: Re: c++/9377: g++ 64bit calls wrong function -> Multi-inheritance: pointer to member function of the 2nd base calss points to wrong place Date: Tue, 21 Jan 2003 15:30:10 -0600 (CST) Andrew, Thanks for the answers. > d1ptr = (D*) new B2 ; //with the cast, we can also do this > printf( "%s\n", (d1ptr->*select(1))() ) ; This can really only work by chance. By creating a B2 you run code that sets up the virtual function table for a B2, and invoking a function from the D function table will invoke undefined behavior. I also bet that this will not work with virtual inheritance. W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth/