[Issue 15305] New: std.manip.bitfields generate bogous code

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Nov 8 18:28:12 PST 2015


https://issues.dlang.org/show_bug.cgi?id=15305

          Issue ID: 15305
           Summary: std.manip.bitfields generate bogous code
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: deadalnix at gmail.com

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.

--


More information about the Digitalmars-d-bugs mailing list