[Bug c++/11622] pointer to multiply derived class where both base classes have virtual member function != pointer to second base class after assignment

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 21 21:03:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11622


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From bangerth at dealii dot org  2003-07-21 21:03 -------
I fail to see what's wrong: of course B and C have different addresses!
'A' may be an empty base class, but the ABI specifies that even empty base
classes cannot have the same address (maybe even the standard does, I
forgot about that). The hack with decreasing BPtr makes the whole thing
work just by chance. I don't see what your testcase attempts to prove, but
maybe you can enlighten us?

Besides, every good textbook should advise that classes with
virtual functions should really have a virtual destructor, too.

W.



More information about the Gcc-bugs mailing list