[Issue 21636] New: std.bitmanip: bitfields size of bitfield should be checked against size of used type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Feb 13 10:46:09 UTC 2021
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: nobody at puremagic.com
Reporter: bugzilla at bernis-buecher.de
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.
--
More information about the Digitalmars-d-bugs
mailing list