Bug 4057 – [CTFE] inplace array change

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-04-03T07:59:00Z
Last change time
2015-06-09T05:13:46Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-04-03T07:59:17Z
This D2 code asserts with dmd 2.042: void foo(int[] ra) { ra[0] = 20; } int[] bar() { int[] data = [10]; foo(data); return data; } void main() { int[] r1 = bar(); assert(r1[0] == 20); enum int[] r2 = bar(); assert(r2[0] == 20); // Assertion failure } This is quite important, because it introduces silent bugs. It can be related to bug 1330.
Comment #1 by clugdbug — 2010-04-03T11:20:23Z
A very high fraction of CTFE bugs are either duplicates of bug 1330, or else blocked by it. *** This issue has been marked as a duplicate of issue 1330 ***