www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10307] New: Bad error message for not supported array operation


           Summary: Bad error message for not supported array operation
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2013-06-08 15:03:11 PDT ---
Currently this array operation is not a supported because there is no explicit
allocation of the modified array:

import std.math;
double sum(double[] data) {
    double result = 0.0;
    foreach (d; data)
        result += d;
    return result;
void main() {
    double[2] a = [2.0, 3.0];
    assert(sum(a[] ^^ 2) == 13.0);

dmd 2.064alpha gives this error message:

test.d(10): Error: Array operation a[] ^^ 2L not implemented

I suggest to improve the error message.

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