This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/44733] a bug with virtual base class (?)



------- Comment #1 from redi at gcc dot gnu dot org  2010-06-30 22:28 -------
conversion from derived* to vbase* involves adjusting a pointer

in the context of vbase::set_p the value returned from me() is converted to
vbase* so the pointer is adjusted

try changing derived::me() to this:

  int b;
  derived* me()
  {
    cout << "derived::me() = " << this << endl;
    cout << "derived::me() as vbase = " << (vbase*)this << endl;
    return this;
  };

you will see that the value is different, and the second value is the one
assigned to ::p


-- 

redi at gcc dot gnu dot org changed:

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]