Annex F (informative) Core undefined behavior [ub]

F.6 [class]: Classes [ub.class]

F.6.9[ub:class.cdtor.typeid]
Specified in: [class.cdtor]

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 { virtual void 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 B typeid(*v); // defined, *v has type V, a base of B yields std​::​type_info for B typeid(*a); // undefined behavior, type A not a base of B } — end example]