Bug 23862 – with statement should accept an expression with enum type
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-04-26T01:50:54Z
Last change time
2023-04-26T08:59:06Z
Keywords
pull
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2023-04-26T01:50:54Z
enum E { A, B }
void test(E e) {
with (e)
switch (e) {
case A:
case B:
default:
break;
}
}
fails with:
Error: `with` expressions must be aggregate types or pointers to them, not `E`
This should work.
Comment #1 by dlang-bot — 2023-04-26T07:49:25Z
@WalterBright created dlang/dmd pull request #15131 "fix Issue 23862 - with statement should accept an expression with enu…" fixing this issue:
- fix Issue 23862 - with statement should accept an expression with enum type
https://github.com/dlang/dmd/pull/15131
Comment #2 by dlang-bot — 2023-04-26T08:59:06Z
dlang/dmd pull request #15131 "fix Issue 23862 - with statement should accept an expression with enu…" was merged into master:
- 0dc5397021ae37cddd4f4604eff9dd6872506b2d by Walter Bright:
fix Issue 23862 - with statement should accept an expression with enum type
https://github.com/dlang/dmd/pull/15131