D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4057 - [CTFE] inplace array change
Summary: [CTFE] inplace array change
Status: RESOLVED DUPLICATE of issue 1330
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-03 07:59 UTC by bearophile_hugs
Modified: 2015-06-09 05:13 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-04-03 07:59:17 UTC
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 Don 2010-04-03 11:20:23 UTC
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 ***