WTF: dmd 2.066 vs. dmd 2.067 really dangerous code breakage
Daniel Kozak via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 22 04:29:30 PDT 2015
On Wednesday, 22 April 2015 at 11:28:44 UTC, Daniel Kozak wrote:
static struct S
{
immutable FLAG_ON = 1;
immutable FLAG_GPRS = 2;
immutable FLAG_HIDDEN = 4;
ubyte flags;
ubyte value;
bool isFlagSet(int flag)
{
return flags && flag == flag;
}
}
void main(string[ ] args)
{
auto someData = [0x01, 0x10, 0x02, 0x16, 0x04, 0x08];
auto countS = someData.length / S.sizeof;
S[] sArray = (cast(S*)someData.ptr)[0 .. countS];
assert(sArray.length == 3);
}
More information about the Digitalmars-d
mailing list