Bug 23546 – bad error message for forward referenced member in enum
Status
RESOLVED
Resolution
WORKSFORME
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-12-10T13:04:21Z
Last change time
2024-05-06T01:06:54Z
Assigned to
No Owner
Creator
Nick Treleaven
Comments
Comment #0 by nick — 2022-12-10T13:04:21Z
From: https://dlang.org/spec/enum.html#named_enums
enum C
{
A = B, // A = 4
B = D, // B = 4
C = 3, // C = 3
D // D = 4
}
This causes:
enumerr.d(6): Error: cannot implicitly convert expression `4` of type `int` to `C`
Note A does not affect this bug.
Either:
* dmd should allow this
* dmd should give a better error message and the spec should be updated.