Could reinterpret_cast turn an invalid pointer value into a valid one?
问题 Consider this union: union A{ int a; struct{ int b; } c; }; c and a are not layout-compatibles types so it is not possible to read the value of b through a : A x; x.c.b=10; x.a+x.a; //undefined behaviour (UB) Trial 1 For the case below I think that since C++17, I also get an undefined behavior: A x; x.a=10; auto p = &x.a; //(1) x.c.b=12; //(2) *p+*p; //(3) UB Let's consider [basic.type]/3: Every value of pointer type is one of the following: a pointer to an object or function (the pointer is