www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23522] New: Error message when enum type is not integral and

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 puremagic.com
          Reporter: qs.il.paperinik 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`
```

--
Nov 30 2022