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

--- Comment #9 from Thomas W. Lynch <dimitrisdad at gmail dot com> 2012-05-04 
19:25:08 UTC ---
I went to take 'this_type' out of the source. You were correct to focus on
that.

As malloc() returns a void *  there must be a cast to access the fields in the
instance.  We routinely use 'this_type' in our shop, which is defined to be the
same as the class name.  However, if you put the class name in,  e.g. (A *)
malloc(..)  then you would definitely get the offset for an A, even after the
method is inherited into a B.

The question comes down to, then, if when inheriting a method into a child, if
the typedefs in the child apply or the typedefs in the parent apply. It should
be the typedefs of the child, as offsets (type) is adjusted in inheritance. It
would eliminate a lot of otherwise valid looking code otherwise.

This looks to be a general issue with multiple inheritance having nothing to do
with operator new. Let me check that..

Though lets also keep in mind, the compiler makes no noise at all in this
situation.

Reply via email to