Summary: Array Ops silently fail when no slice symbol is used.
           Product: D
           Version: 2.022
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD

import std.stdio;

void main() {
    double[] foo = [1.0,2,3,4,5].dup;
    double[] bar = [6.0,7,8,9,10].dup;
    foo[] += bar;  // foo now still == [1.0, 2.0, 3.0, 4.0, 5.0].
    foo[] += bar[];  // Works.
    uint[] intFoo = [1u,2,3,4,5].dup;
    uint[] intBar = [6u,7,8,9,10].dup;
    intFoo[] += intBar;  // intFoo is now [6,7,8,9,10].
    intFoo[] += intBar[];
    writeln(intFoo);  // Works.

The compiler should either reject array ops in the form of foo[] += bar, or it
should work.  Either way, it should not fail silently with results that are
arbitrary and inconsistent among types.


Reply via email to