7880 – [CTFE] cast from void array allowed with different results than at runtime

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7880 - [CTFE] cast from void array allowed with different results than at runtime
Summary: [CTFE] cast from void array allowed with different results than at runtime
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid, CTFE, pull
Depends on:
Blocks:
Reported: 2012年04月09日 14:19 UTC by timon.gehr
Modified: 2012年04月30日 15:28 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description timon.gehr 2012年04月09日 14:19:21 UTC
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.
Comment 1 Don 2012年04月11日 11:20:46 UTC
This bug applies to casting any slice of another array, not just a void[] slice.
https://github.com/D-Programming-Language/dmd/pull/873 
Comment 2 github-bugzilla 2012年04月14日 12:05:00 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/ca6e0d36c41ed4b725e76a0b4fc6fdb28f08cf56
Fix issue 7880 [CTFE] cast from void array allowed with different results than at runtime
Actually applies to casts of any kind of slice, not just void[].
https://github.com/D-Programming-Language/dmd/commit/e919e37f26f9b9ea042a1d317cd1e392c4e432f3
Merge pull request #873 from donc/ctfe7880arraycast
Fix issue 7880 [CTFE] cast from void array allowed with different result...


AltStyle によって変換されたページ (->オリジナル) /