[Issue 23074] New: premature enum type inference leads to spurious error message
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 30 23:44:18 UTC 2022
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 at puremagic.com
Reporter: b2.temp at gmx.com
## test case
```
enum E { e1 = S.a }
struct S
{
E e;
enum a = "string";
}
```
## output
> /tmp/temp_7F3BFB9249F0.d:6:14: Error: cannot implicitly convert expression `"string"` of type `string` to `int`
## notes
- if you change the initializer of `S.a` to an integer literal then the program
compiles.
--
More information about the Digitalmars-d-bugs
mailing list