https://issues.dlang.org/show_bug.cgi?id=23618
Salih Dincer <sali...@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sali...@hotmail.com --- Comment #3 from Salih Dincer <sali...@hotmail.com> --- The problem is also seen when the sign extension is not done. Here is the test code: struct TestType(T) { import std.traits : Unsigned; alias U = Unsigned!T; T t = T.min; // sample: -128 for byte U u = U.max/2 + 1; // sample: 128 for ubyte } void main() { alias T = long; // int, short, byte TestType!T v1, v2; enum bits = T.sizeof * 8 - 1; v1.t >>= bits; assert(v1.t == -1); // okay, because signed type v1.u >>= bits; assert(v1.u == 1); // okay, because unsigned type v2.t >>>= bits; assert(v2.t == 1); /* okay, no sign extension but -1 for byte, short, int */ v2.u >>>= bits; assert(v2.u == 1); // okay, no sign extension } SDB@79 --