[Issue 4662] New: Array ops on const arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 17 07:06:18 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4662

           Summary: Array ops on const arrays
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-08-17 07:06:13 PDT ---
This D2 program shows two problems (dmd 2.048):


void foo(const double[] arr1) {
    arr1[] += 1;      // line 2, no error here
    double[] arr2;
    arr1[] += arr2[]; // line 4, Error here
}
void main() {}


The first problem is at line 2, where the const nature of arr1 is ignored.

The second problem is at line 4, that generates a wrong error message:

test.d(4): Error: invalid array operation arr1[] += cast(const(double[]))arr2[]
(did you forget a [] ?)

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


More information about the Digitalmars-d-bugs mailing list