Bug 13739 – in CTFE making an array over an array copies the data

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-11-17T00:17:00Z
Last change time
2015-01-21T08:32:01Z
Keywords
CTFE, pull
Assigned to
nobody
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2014-11-17T00:17:27Z
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()); }
Comment #1 by k.hara.pg — 2015-01-20T16:26:45Z
Comment #2 by github-bugzilla — 2015-01-21T08:32:01Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e19fb05e0f00aece7aa81e94a70707be5eb586c2 fix Issue 13739 - in CTFE making an array over an array copies the data https://github.com/D-Programming-Language/dmd/commit/f0a2c75cd1c2bee2b082b154181972d705072457 Merge pull request #4320 from 9rnsr/fix13739 Issue 13739 - in CTFE making an array over an array copies the data