https://issues.dlang.org/show_bug.cgi?id=13739
Issue ID: 13739
Summary: in CTFE making an array over an array copies the data
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: CTFE, wrong-code
Severity: normal
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
bool test()
{
int[] a1 = [13];
int[][] a2 = [a1];
assert(a2[0] is a1); /* passes even in CTFE, weird */
assert(a2[0].ptr is a1.ptr); /* fails in CTFE */
a1[0] = 1;
assert(a2[0][0] == 1); /* fails in CTFE */
a2[0][0] = 2;
assert(a1[0] == 2); /* fails in CTFE */
return true;
}
void main()
{
version(rt) assert(test());
version(ct) static assert(test());
}
--