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