Bug 5942 – Bitfields are overwritten erroneously

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2011-05-07T04:03:00Z
Last change time
2013-10-05T08:17:46Z
Assigned to
rtcvb32
Creator
samukha

Comments

Comment #0 by samukha — 2011-05-07T04:03:20Z
struct S { mixin(bitfields!( int, "a" , 32, int, "b" , 32 )); } void main() { S data; data.b = 42; data.a = 1; assert(data.b == 42); // fail } Looks like assigning fields at offsets < 32 bit clears fields at offsets >= 32 bit.
Comment #1 by rtcvb32 — 2012-08-01T08:08:03Z
resolving issues 6686 and 8474 resolve this problem. Once pull is accepted, this will be resolved. http://d.puremagic.com/issues/show_bug.cgi?id=6686 http://d.puremagic.com/issues/show_bug.cgi?id=8474
Comment #2 by code — 2013-10-05T08:17:46Z