www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12985] New: Better error message for not supported array

https://issues.dlang.org/show_bug.cgi?id=12985

          Issue ID: 12985
           Summary: Better error message for not supported array operation
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

void foo(int[] b) {}
void main() {
    int[2] a = [1, 2];
    foo(a[] * 2);
}


dmd 2.066alpha gives:

test.d(4,9): Error: array operation a[] * 2 without assignment not implemented


I suggest a better error message like:

test.d(4,9): Error: array operations that allocate memory are not supported for
performance reasons


See also issue 10307

--
Jun 24 2014