https://issues.dlang.org/show_bug.cgi?id=19402
Issue ID: 19402 Summary: bitshift with long shift amount results in int instead of long Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dkor...@live.nl https://dlang.org/spec/expression.html#shift_expressions "If the operands are of integral types, they undergo the Usual Arithmetic Conversions, and then are brought to a common type using the Usual Arithmetic Conversions." https://dlang.org/spec/type.html#usual-arithmetic-conversions "If both are signed or both are unsigned, the smaller type is converted to the larger." Yet: ``` long x = 1L; auto a = 1 << x; ``` Compiles to: (-vcg-ast) ``` long x = 1L; int a = 1 << cast(int)x; ``` I expected this: ``` long x = 1L; long a = 1L << x; ``` Which caused a nasty bug in my program. --