If the operand of typeid refers to
the object under construction or destruction and the static type of the operand is neither the constructor or
destructor's class nor one of its bases, the behavior is undefined.
[Example 1: struct V {virtualvoid f();
};
struct A :virtual V {};
struct B :virtual V {
B(V *, A *);
};
struct D : A, B {
D(): B((A *)this, this){}};
B::B(V *v, A *a){typeid(*this); // std::type_info for Btypeid(*v); // defined, *v has type V, a base of B yields std::type_info for Btypeid(*a); // undefined behavior, type A not a base of B} — end example]