Bug 10252 – CTFE: Should generate error for shifts outside valid range

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-03T04:17:00Z
Last change time
2015-06-09T05:11:44Z
Keywords
accepts-invalid, CTFE
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2013-06-03T04:17:02Z
Const-folding generates errors whenever a shift (>>, <<, or >>>) exceeds the valid range. CTFE should too. For example, this code should fail to compile: --- int foo() { int shift = 60; int a = 5; return a << shift; } static assert(foo());
Comment #1 by github-bugzilla — 2013-06-04T18:14:01Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/22973a6c7103528a82ec2f5d5fc61653097535c3 Fix bug 10252 CTFE: Generate error for shr/ushr/shl out of range Use same behaviour as for const-folding.
Comment #2 by github-bugzilla — 2013-09-13T10:46:01Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/670253c5fe78f3eac2d9236c305c4c061c149529 Fix bug 10252 CTFE: Generate error for shr/ushr/shl out of range Use same behaviour as for const-folding.