//////// test.d //////// struct S { enum E { e1 = 0, } E e; enum S s1 = S(E.e1); } SE se; enum SE { e1 = S.s1 } //////////////////////// test.d(8,15): Error: cannot implicitly convert expression `S(E.e1)` of type `S` to `int` If the declaration of `SE` and the use `SE se;` are reordered, the problem goes away.
@RazvanN7 created dlang/dmd pull request #12437 "Fix Issue 21828 - Using enum of struct (containing another enum) before its declaration fails" fixing this issue: - Fix Issue 21828 - Using enum of struct (containing another enum) before its declaration fails https://github.com/dlang/dmd/pull/12437
@BorisCarvajal created dlang/dmd pull request #12438 "Fix Issue 21828 - Using enum of struct (containing another enum) befo…" fixing this issue: - Fix Issue 21828 - Using enum of struct (containing another enum) before its declaration fails https://github.com/dlang/dmd/pull/12438
reduced test case: ---- E e; enum E { a = "x" } ---- Forward references just assume int value.
dlang/dmd pull request #12438 "Fix Issue 21828 - Enum forward-references just assume int base type" was merged into master: - 38a016e434505cb642aab480142a40343e2b4174 by Boris Carvajal: Fix Issue 21828 - Enum forward-references just assume int base type https://github.com/dlang/dmd/pull/12438