D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6800 - [CTFE] dangerous pointer casts should be rejected
Summary: [CTFE] dangerous pointer casts should be rejected
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2011-10-10 01:17 UTC by Don
Modified: 2015-06-09 05:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2011-10-10 01:17:58 UTC
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.