(4.1/1) If the object to which the lvalue refers is not an object of
type T and is not an object of a type derived from T, or if the object
is uninitialized, a program that necessitates this conversion has
undefined behavior.
From this, I assume
struct B {
int x; };
B *p;
*p; //undefined behavior
*p is a lvalue which refers to an uninitialized object. How can it refer to an object which is not the type of ‘B’ or its derived type? Am i misunderstanding something?
Easy:
Less easy:
Common C pitfall (produces no diagnostic!):