www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24262] New: Assert error with bit fields

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

          Issue ID: 24262
           Summary: Assert error with bit fields
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

typedef struct
{
    unsigned id : 15;
    _Bool done : 1;
} Entry;

typedef struct
{
    Entry e;
} State;

void advance(unsigned i)
{
    State s = (State){i};
}
core.exception.AssertError src/dmd/e2ir.d(6557): Assertion failure
----------------
??:? _d_assertp [0x5630e3e241cc]
src/dmd/e2ir.d:6557 dmd.backend.el.elem*
dmd.e2ir.toElemStructLit(dmd.expression.StructLiteralExp, ref dmd.toir.IRState,
dmd.tokens.EXP, dmd.backend.cc.Symbol*, bool) [0x5630e3cc6994]
src/dmd/e2ir.d:4077 dmd.backend.el.elem*
dmd.e2ir.toElem(dmd.expression.Expression, ref
dmd.toir.IRState).visitStructLiteral(dmd.expression.StructLiteralExp)
[0x5630e3cc047e]
...

--
Nov 25 2023