This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9377: g++ 64bit calls wrong function -> Multi-inheritance: pointer to member function of the 2nd base calss points to wrong place
- From: bangerth at dealii dot org
- To: axiong at ca dot ibm dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 21 Jan 2003 17:27:05 -0000
- 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: bangerth at dealii dot org, axiong at ca dot ibm dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: g++ 64bit calls wrong function -> Multi-inheritance: pointer to member function of the 2nd base calss points to wrong place
State-Changed-From-To: closed->open
State-Changed-By: bangerth
State-Changed-When: Tue Jan 21 17:27:05 2003
State-Changed-Why:
I am still pretty sure that what you try is not legal, but
I'll reopen it and let someone else have a second look on it.
My questions are (maybe you can send an answer to these):
- why do you need the cast from &B2::bar to D::*? I
think that's the crucial step -- if your program is
supposed to work, then this cast would not be necessary,
but rather be an implicit default conversion.
- what's the purpose of the select() method you have there?
The comment implies that without it, there's a problem.
But what exactly is it?
My idea about this is that if you take &B2::bar, then since
B2::bar is a virtual function, the member function pointer
actually is a pointer into the virtual function table of B2.
If you later call the function with an object of type "D",
then you call it through the virtual function table of D,
so a conversion is necessary. The question is whether this
happens.
Regards
Wolfgang
PS: The code works on sparc in 32 and 64 bit mode as you
would expect it, but I can't check for the PPC platform
you have.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9377