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

          Issue ID: 23546
           Summary: bad error message for forward referenced member in
                    enum
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

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.

--

Reply via email to