Bug 6800 – [CTFE] dangerous pointer casts should be rejected
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-10-10T01:17:00Z
Last change time
2015-06-09T05:11:45Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2011-10-10T01:17:58Z
Some dangerous casts are currently accepted, but shouldn't be:
static assert({
int *x = (new int[2]).ptr;
double* ary= cast(double *)x;
return true;
}());
This shouldn't compile. This is vaguely related to bug 6792; it's a type painting issue.