[Issue 2546] New: Array Ops silently fail when no slice symbol is used.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 30 14:22:46 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2546
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 at digitalmars.com
ReportedBy: dsimcha at 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].
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.
--
More information about the Digitalmars-d-bugs
mailing list