c++/9377: g++ 64bit calls wrong function -> Multi-inheritance: pointer to member function of the 2nd base calss points to wrong place

bangerth@dealii.org bangerth@dealii.org
Tue Jan 21 17:30:00 GMT 2003


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



More information about the Gcc-bugs mailing list