www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23635] New: Nonsensical "`case` must be a `string` or an

https://issues.dlang.org/show_bug.cgi?id=23635

          Issue ID: 23635
           Summary: Nonsensical "`case` must be a `string` or an integral
                    constant, not `x`"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P4
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

```
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. --
Jan 16 2023