Violating strict-aliasing, even without any casting?
问题 I think I'm really asking: is aliasing "transitive"? If the compiler knows that A might alias B, and B might alias C, then surely it should remember that A might therefore alias C. Perhaps this "obvious" transitive logic isn't required however? An example, for clarity. The most interesting example, to me, of a strict-aliasing issue: // g++ -fstrict-aliasing -std=c++11 -O2 #include <iostream> union { int i; short s; } u; int * i = &u.i; int main() { u.i = 1; // line 1 *i += 1; // line 2 short