digitalmars.D.learn - dmd Regression(?): bigEndianToNative buffer slice allows only literals
- Lucas Burson (21/21) May 13 2015 The std.batmanip bigEndianToNative has a regression where the
- Lucas Burson (2/2) May 13 2015 I reported this as a regression
The std.batmanip bigEndianToNative has a regression where the slice range doesn't work with variables (only literals). Is the syntax incorrect or is this a regression in dmd? Using this main.d: import std.bitmanip; int main(string args[]) { auto datain = new ubyte[16]; // this syntax works ushort descriptorLength = bigEndianToNative!ushort(datain[2..4]); // this syntax fails (worked in previous version) int offset = 2; descriptorLength = bigEndianToNative!ushort(cast(ubyte[2]) datain[offset..offset+2]); return 0; } I get this error on the command line: main.d(14): Error: cannot cast expression datain[cast(uint)offset..cast(uint)(offset + 2)] of type ubyte[] to ubyte[2]
May 13 2015
I reported this as a regression https://issues.dlang.org/show_bug.cgi?id=14582
May 13 2015