[Issue 13739] New: in CTFE making an array over an array copies the data
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Nov 16 16:17:27 PST 2014
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: nobody at puremagic.com
Reporter: ag0aep6g at gmail.com
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());
}
--
More information about the Digitalmars-d-bugs
mailing list