[Issue 24263] -preview=bitfields: Bit field address escapes through `ref`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 9 14:44:41 UTC 2024


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

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |nick at geany.org

--- Comment #1 from Nick Treleaven <nick at geany.org> ---
Same when passing a bitfield as a ref argument:

struct S
{
    uint a:1,
         b:1,
         c:1;
}
void f(ref uint b) { b++; }

void main()
{
    S s;
    s.a.f; // allowed! Silently does nothing
    assert(s.a == 0); // unaffected
}

--


More information about the Digitalmars-d-bugs mailing list