www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2546] New: Array Ops silently fail when no slice symbol is used.

reply d-bugmail puremagic.com writes:

           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
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dsimcha yahoo.com

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.

Dec 30 2008
parent d-bugmail puremagic.com writes:

Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED

--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2010-05-31
19:02:59 PDT ---

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