Is type punning arrays of same type but different size allowed?

Viewed 261

Is type punning arrays of the same type but with a different size still a violation of strict aliasing?

int arr[4];
int(&ref)[2] = reinterpret_cast<int(&)[2]>(arr);

arr[0] = 0; //write to original
ref[0]; //read from pun
1 Answers
Related