This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44733] a bug with virtual base class (?)
- From: "redi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jun 2010 22:28:43 -0000
- Subject: [Bug c++/44733] a bug with virtual base class (?)
- References: <bug-44733-19384@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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