https://issues.dlang.org/show_bug.cgi?id=21636
Issue ID: 21636
Summary: std.bitmanip: bitfields size of bitfield should be
checked against size of used type
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
struct A
{
mixin(bitfields!(byte, "x", 32));
}
unittest
{
A a;
a.x = 17;
}
produces
test.d-mixin-5(6): [unittest] Value is greater than the maximum value of
bitfield 'x'
The reason is, that a byte cannot hold 32 bits.
--