Bug 21544 – -checkaction=context formats enum members as their base type
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-01-13T00:33:59Z
Last change time
2021-01-25T13:33:31Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2021-01-13T00:33:59Z
-checkaction=context doesn't recognize enums, e.g.:
enum E { A, BCDE }
void main()
{
E a = E.A;
E b = E.BCDE;
assert(a == b);
}
[email protected](7): 0 != 1
The error message should probably print the exact member or at least include `cast(E)` as done e.g. for static assert.
Comment #1 by dlang-bot — 2021-01-21T12:07:26Z
@MoonlightSentinel created dlang/druntime pull request #3336 "Fix 21544 - -checkaction=context formats enum members as their base type" fixing this issue:
- Fix 21544 - -checkaction=context formats enum members as their base type
Generate code that detects the correct enum member (or defaults to the
base type in case of an invalid enum value).
https://github.com/dlang/druntime/pull/3336
Comment #2 by dlang-bot — 2021-01-25T13:33:31Z
dlang/druntime pull request #3336 "Fix 21544 - -checkaction=context formats enum members as their base type" was merged into master:
- 02dd9d99f415ba1ba4fae6e2d590a967cd03c385 by MoonlightSentinel:
Fix 21544 - -checkaction=context formats enum members as their base type
Generate code that detects the correct enum member (or defaults to the
base type in case of an invalid enum value).
https://github.com/dlang/druntime/pull/3336