import std.bitmanip;
struct S {
mixin(bitfields!(
bool, "alice", 1,
ulong, "bob", 63,
));
}
S s;
s.bob = long.max - 1;
s.alice = false;
assert(s.bob == long.max - 1);
Setting alice to false is clearing bits in bob, while it really shouldn't.
Comment #1 by lio+bugzilla — 2015-11-16T11:10:14Z
The generated setter for alice is wrong:
@property void alice(bool v) @safe pure nothrow @nogc { if (v) _alice_bob |= 1U;else _alice_bob &= ~1U;}
and it's wrong because the &=~1U would clear not just the first bit, but bits 32-64 as well. This in turn because of the code in myToString, which picks the smallest type suffix, "U" in this case.