[Issue 2892] Appending U[] to T[] where U : T but U != T yields corrupted results
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 29 13:25:57 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2892
------- Comment #3 from dsimcha at yahoo.com 2009-04-29 15:26 -------
Also, this doesn't happen only for array literals. Here, I .dup the literals
to make sure they're allocated like "normal" arrays and it still happens.
import std.stdio;
void main() {
uint[] foo = [1U,2,3,4,5].dup;
ubyte[] bar = [cast(ubyte) 1,2,3,4].dup;
foo ~= bar;
writeln(foo); // 1 2 3 4 5 67305985
foo.length = 5;
ulong[] baz = [1UL,2,3,4].dup;
foo ~= baz;
writeln(foo); // 1 2 3 4 5 1 0 2 0 3 0 4 0
}
--
More information about the Digitalmars-d-bugs
mailing list