www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24263] New: -preview=bitfields: Bit field address escapes

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

          Issue ID: 24263
           Summary: -preview=bitfields: Bit field address escapes through
                    `ref`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ogion.art gmail.com

struct S {
    ubyte _x:4, _y:4;
    ubyte* p() => &_x;   // Error: cannot take address of bit-field `_x`
    ref ubyte x() => _x; // Compiles
}

--
Nov 27 2023