www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23074] New: premature enum type inference leads to spurious

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

          Issue ID: 23074
           Summary: premature enum type inference leads to spurious error
                    message
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com



```
enum E { e1 = S.a }

struct S
{
    E e;
    enum a = "string";
}
```



 /tmp/temp_7F3BFB9249F0.d:6:14: Error: cannot implicitly convert expression
`"string"` of type `string` to `int`
- if you change the initializer of `S.a` to an integer literal then the program compiles. --
Apr 30 2022