May 14, 2015 dmd Regression(?): bigEndianToNative buffer slice allows only literals | ||||
---|---|---|---|---|
| ||||
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 14, 2015 Re: dmd Regression(?): bigEndianToNative buffer slice allows only literals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lucas Burson | I reported this as a regression https://issues.dlang.org/show_bug.cgi?id=14582 |
Copyright © 1999-2021 by the D Language Foundation