One thing to watch out here, is that the original question commented
about space constraints and wanting to avoid helper pointers, but this
multiple inheritance situation may implicitly create such pointers (at
least if you want to get the right answer)
Also, using (Derived*)inner in this sense is using a C style cast, which
will in this case be a reinterpret_cast if I am parsing things right,
which will only work if inner is at offsetof of 0. The side effect of
this is that the reinterpret_cast is UB if the inner isn't part of
Derived or not at offset 0 (and since Base has data members, it really
can't have an offset of 0). You could use instead a dynamic_cast which
will detect the issue and return a 0. To use the dynamic_cast, inner
will need to have a virtual function so it can have RTTI (which gets us
back to the need for helpers).
In C++, using C Style casts is generally a bad idea, because you have
lost the ability to detect that you are doing something dangerous. A C
style cast can convert ANY pointer to ANY OTHER pointer, regardless of
if it really makes sense. Use a static_cast if you can, as that is much
safer, and it will reject code trying to do things it shouldn't be
doing. dynamic_cast is also safe, but more expensive, as it will need to
inspect the RTTI info of the object. reinterpret_cast needs to be used
with care, as does const_cast, and these being explicit are easier to
review.
Going back to the original question, the fact that you got a warning,
and not an error, says that the implementation may support this
operation, even though the standard doesn't require it to. Thus we get
back to the initial question, to do this by the standard, inner will
need to increase by the size of a pointer, either to add the implicit
vtable pointer to get RTTI, or adding a pointer of our own to provide
the owner. Or, if the implementation supports the extension, use
offsetof on a non-standard-layout structure. This case SHOULD have a
well defined layout for most systems, it is just that the standard gives
the implementation some flexability. offsetof probably could have been
defined for a wider range of structures, but standard-layout was a
defined class of them that it could clearly work and handles the need
for compatibility with C.