Does removing const from a pointer-to-const obey strict aliasing in C, and refer to the same object?
问题 Does the following code in C have defined behavior? int main() { const int i = 0; return *(int*)(&i); } I ask because 6.5/7 lists "a qualified version of a type compatible with the effective type of the object" as a valid alias. But the effective type of the object is const int , and I don't think int is a qualified version of const int (although the reverse is true). Neither are int and const int compatible (6.7.3/10). Furthermore, 6.3.2.3/2 says that you can convert pointer types by adding