[Issue 2892] New: Appending U[] to T[] where U : T but U != T yields corrupted results

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 24 18:25:11 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2892

           Summary: Appending U[] to T[] where U : T but U != T yields
                    corrupted results
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dsimcha at yahoo.com


import std.stdio;

void main() {
    uint[] foo = [1,2,3,4,5];
    ubyte[] bar = [1,2,3,4];
    foo ~= bar;
    writeln(foo);  // 1 2 3 4 5 67305985
    foo.length = 5;
    ulong[] baz = [1,2,3,4];
    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