Behavior is undefined if a glvalue referring to an object outside of its
lifetime is used as the operand of a
dynamic_cast or as the operand of typeid.
[Example 1: struct B {virtual~B(); };
struct D :virtual B {};
void f(){
D d;
B& br = d;
d.~D();
D& dr =dynamic_cast<D&>(br); // undefined behavior} — end example]