digitalmars.D.bugs - [Issue 22624] New: importC: bit field misaligns following members in
- d-bugmail puremagic.com (41/41) Dec 22 2021 https://issues.dlang.org/show_bug.cgi?id=22624
https://issues.dlang.org/show_bug.cgi?id=22624 Issue ID: 22624 Summary: importC: bit field misaligns following members in D struct .init Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: duser airmail.cc mod.c: --- struct cstruct { unsigned int bit : 1; }; --- main.d: --- import std.stdio; import mod; struct dstruct { cstruct x; ubyte[8] msg = [1, 2, 3, 4, 5, 6, 7, 8]; } void main() { dstruct v; writeln(v.msg); assert(dstruct.init.msg == [1, 2, 3, 4, 5, 6, 7, 8]); // ok assert(v.msg == [1, 2, 3, 4, 5, 6, 7, 8]); // error } --- it should print the array as written in the source, but instead it prints [0, 0, 0, 0, 1, 2, 3, 4] version: DMD64 D Compiler v2.098.0-361-g415e58e6d (current git master) --
Dec 22 2021