https://issues.dlang.org/show_bug.cgi?id=22710
Issue ID: 22710 Summary: Different behaviour of bitfields between CTFE and runtime Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: moonlightsenti...@disroot.org The CTFE engine ins't aware of the subtle differences of bitfields vs normal variables. This manifests e.g. in incorrect overflow behaviour: --- app.d import bitfields; extern(C) int main() { HasBitfield bf; bf.a += 4; assert(bf.a == 0); // Fails during CTFE assert(bf.b == 0); return 0; } enum test = main(); --- bitfields.c struct HasBitfield { int a : 2; int b : 2; }; --