D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23635 - Nonsensical "`case` must be a `string` or an integral constant, not `x`"
Summary: Nonsensical "`case` must be a `string` or an integral constant, not `x`"
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 minor
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2023-01-16 13:50 UTC by Dennis
Modified: 2023-01-21 21:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dennis 2023-01-16 13:50:26 UTC
```
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 Dlang Bot 2023-01-21 16:06:18 UTC
@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 Dlang Bot 2023-01-21 21:34:15 UTC
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