移位运算符右操作数为负数或超过相关类型比特位的数量
C++-Undefined-Behavior-47
示例:
int a = 1 << -1; // Undefined behavior
int b = 1 << 100; // Undefined behavior
依据
ISO/IEC 14882:2003 5.8(1)-undefined
ISO/IEC 14882:2011 5.8(1)-undefined
示例:
int a = 1 << -1; // Undefined behavior
int b = 1 << 100; // Undefined behavior