It could also be converted later to base*.
If you don't mind undefined behavior. The only legal use of a
void* is converting it back to the original type. Here, the
original type is der*, not base*.
I think my real code might violate 12.7/3. Where it says
"might use path E* -> D*-> A*" is it implying that conversions
from E* to C* and D* are equally good because they are
directly inherited base classes? If I remove C, B and X from
the example and force the conversions of E* -> D*-> A* the
Comeau compiler gives no diagnostics but the standard is
saying its undefined behaviour.
You'll have to show use your real code. My comments concerning
undefined behavior mainly concerned the passage through a void*.
The examples in 12.7/3 don't have any void*. §12.7/2 does
guarantee that you could pass your this to a base*, but it
doesn't say anything about a void*.
struct D : virtual A {
D(A*);
};
struct E : D {
E() : D(this) {}// undefined: upcast from E* to A* might use path E* !
D* ! A*
};
I'm not sure vis-a-vis the standard, but I do know that this
fails with certain compilers.
Curiously, you can call member functions of A in the same
context (and calling such functions requires the same
conversion). And the member function can return its this
pointer.