Bug 7880 – [CTFE] cast from void array allowed with different results than at runtime
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-09T14:19:00Z
Last change time
2012-04-30T15:28:29Z
Keywords
accepts-invalid, CTFE, pull
Assigned to
nobody
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2012-04-09T14:19:21Z
DMD 2.058/2.059head
int bar(){
int[] y = new int[2];
y[0]=2000000;
void[] x = y;
return (cast(byte[])x)[1];
}
static assert(!is(typeof({enum _ = (assert(!bar()),1);}))); // fail
The static assertion should pass.