http://d.puremagic.com/issues/show_bug.cgi?id=2542
Summary: array casts behave differently at compile and runtime Product: D Version: 1.037 Platform: PC OS/Version: Linux Status: NEW Keywords: spec Severity: normal Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: kamm-removet...@incasoftware.de This is related to casts of arrays not being documented: http://d.puremagic.com/issues/show_bug.cgi?id=2494 The issue is that the following produce different results: const short[] ct = cast(short[]) [cast(byte)1, 1]; // ct is [1, 1] short[] rt = cast(short[]) [cast(byte)1, 1].dup; // rt is [ 257 ] The runtime cast seems to be defined as 'reinterpret the data as an array of a different type, recompute the length' whereas the compile time cast seems to be 'convert each element to the other element type, keep length unchanged'. --