The C++11/C++14 undefined behavior of left signed shift can be tested similarly, if ((unsigned type for op0's type) op0) >> (precm1 - y) is greater than one, then it is undefined behavior. Jason, doeshttp://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/ n3675.html#1457apply just to C++11/C++14, or to C++03 too?
Doesn't DR1457 also leave neg << 0 as undefined, where "neg" is a negative value? That isn't caught by your "greater than one" expression. Segher