[Issue 23522] New: Error message when enum type is not integral and a value lacks an initializer
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Nov 30 14:37:42 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23522
Issue ID: 23522
Summary: Error message when enum type is not integral and a
value lacks an initializer
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: trivial
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: qs.il.paperinik at gmail.com
If an `enum` has a type that is not numerical, every value must have an
initializer:
```d
enum X : string
{
a = "a",
b // error
}
```
The error message should be very specific (“`b` has no initializer and the
underyling type is not integral”), but it is:
```
Error: no property `max` for type `string`, perhaps `import std.algorithm;` is
needed?
Error: incompatible types for `("a") + (1)`: `X` and `int`
```
--
More information about the Digitalmars-d-bugs
mailing list