www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22713] New: ImportC: op= not correctly implemented for bit

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

          Issue ID: 22713
           Summary: ImportC: op= not correctly implemented for bit fields
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

struct S
{
    unsigned int a:2, b:2;
};

int test()
{
    S s;
    s.a = 3;
    s.a = s.a + 2; // works
    s.a += 2; // incorrect code generated
    return s.a;
}

--
Jan 29 2022