[Issue 12648] New: Array operation return type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 25 07:10:21 PDT 2014


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

          Issue ID: 12648
           Summary: Array operation return type
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: bearophile_hugs at eml.cc

I think both the following should compile:


int[1] foo1(int[1] a) {
    a[] += 10;
    return a;         // OK.
}
int[1] foo2(int[1] a) {
    return a[] += 10; // Error.
}
void main() {}


DMD 2.066alpha gives:

test.d(6,16): Error: cannot implicitly convert expression
(_arrayExpSliceAddass_i(a[], 10)) of type int[] to int[1]

--


More information about the Digitalmars-d-bugs mailing list