June 07, 2022
https://issues.dlang.org/show_bug.cgi?id=23172

          Issue ID: 23172
           Summary: [REG2.100] Wrong cast inserted for ternary operator
                    and non-int enums
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: johanengelen@weka.io

Testcase:
```
enum E : ubyte { // `ubyte` is needed to trigger the bug
    A,
    B,
}

struct S {
    E e;
}

void compiles(bool b, S s) {
    E e = b ? E.A : s.e;
}

void errors(bool b, const ref S s) {
    E e = b ? E.A : s.e;
}
```

Errors with: <source>(15): Error: cannot implicitly convert expression `b ? 0 :
cast(int)s.e` of type `int` to `E`

Fails with LDC 1.30.0-beta1 (dlang 2.100.0), compiles succesfully with LDC 1.29
(dlang 2.099).

--