I have the following code in C++
#include <iostream>
using namespace std;
int main(){
unsigned long long a;
cin>>a;
cout<< (1ull<<64ull) << ' ' << (1ull<<a) << endl;
}
now inputting 64
, the output is
0 1
In short, the compiler seems to use a circular shift at runtime. But from my reading of the relevant cppreference page, I think it's supposed to be normal modular arithmetic, so the bit should just disappear as in the compile-time version. I tested this on GCC 11, GCC 12 and clang 14 so it's extra unlikely to be a compiler bug. So what am I missing here?