Bug 2546 – Array Ops silently fail when no slice symbol is used.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-12-30T16:22:00Z
Last change time
2015-06-09T01:20:51Z
Keywords
accepts-invalid, wrong-code
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2008-12-30T16:22:45Z
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]. writeln(foo); foo[] += bar[]; // Works. writeln(foo); 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]. writeln(intFoo); 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.
Comment #1 by bugzilla — 2010-05-31T19:02:59Z