Bug 23635 – Nonsensical "`case` must be a `string` or an integral constant, not `x`"
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-01-16T13:50:26Z
Last change time
2023-01-21T21:34:15Z
Keywords
pull
Assigned to
No Owner
Creator
Dennis
Comments
Comment #0 by dkorpel — 2023-01-16T13:50:26Z
```
void main()
{
immutable string x, y;
switch (y) {
case x: break;
default: break;
}
}
```
> onlineapp.d(6): Error: `case` must be a `string` or an integral constant, not `x`
x is a string in this case, so the error is nonsensical.
Comment #1 by dlang-bot — 2023-01-21T16:06:18Z
@ntrel created dlang/dmd pull request #14840 "Fix Issue 23635 - Nonsensical "`case` must be a `string` or an integr…" fixing this issue:
- Fix Issue 23635 - Nonsensical "`case` must be a `string` or an integral constant, not `x`"
https://github.com/dlang/dmd/pull/14840
Comment #2 by dlang-bot — 2023-01-21T21:34:15Z
dlang/dmd pull request #14840 "Fix Issue 23635 - Nonsensical "`case` must be a `string` or an integr…" was merged into master:
- e1938d27555ca034b6eaa10be827fedce1031b81 by Nick Treleaven:
Fix Issue 23635 - Nonsensical "`case` must be a `string` or an integral constant, not `x`"
https://github.com/dlang/dmd/pull/14840