[Issue 20678] New: Integral deprecation should not trigger on valid code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 17 03:31:47 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20678
Issue ID: 20678
Summary: Integral deprecation should not trigger on valid code
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: pro.mathias.lang at gmail.com
The current rule for triggering the integral deprecation message are way too
lax and intrusive...
The following is perfectly valid:
```
struct BitField
{
private ushort[] data;
private enum BitsPerT = (ushort.sizeof * 8);
public bool opIndexAssign (bool value, size_t index)
{
if (!value)
{
this.data[index / BitsPerT] &= ~mask(index); // HERE
}
return value;
}
static ushort mask (size_t index)
{
return (1 << ( BitsPerT - 1 - (index % BitsPerT)));
}
}
```
But it forces the user to insert a dumb cast on the line annotated with `//
HERE`.
This can be seen in https://issues.dlang.org/show_bug.cgi?id=19614
--
More information about the Digitalmars-d-bugs
mailing list