www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4057] New: [CTFE] inplace array change

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4057

           Summary: [CTFE] inplace array change
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-04-03 07:59:17 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 03 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4057


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |DUPLICATE


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-04-03 11:20:23 PDT ---
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 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 03 2010