I recently was surprised to learn that the C and C++ language standards have a \"strict aliasing\" rule. In essence, the rule prohibits variables of differing types from ref
"Strict aliasing" is a C++ rule restricting programs, not compilers. Since violating the rule is Undefined Behavior, no diagnostic required a compiler doesn't need to support it in any way.
That said, Microsoft is a bit less aggressive in applying optimizations. Only last week have they announced their new optimizer assumes no signed overflow, something that GCC has assumed for a few years already. Strict aliasing is going to break a few Windows headers, so those need fixing first. (A few types act as if they contain union
s, but they're not formally defined as such)