<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56560>56560</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang crashes when parsing operator== for an enum parameter with a bool enum base and no enumerator list
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          alanzhao1
      </td>
    </tr>
</table>

<pre>
    llvm commit I have checked out where this is broken (not necessarily the cause): 4a40fa82c07238ea28e041dc0e28b4f2953e509e

Repro steps

test.cpp:

```cpp
enum Foo : bool;

bool bar(Foo a, Foo b) {
    return a == b;
}
```

1. Build Clang with `LLVM_ENABLE_ASSERTIONS:BOOL=ON`
2. Run `clang++ -c test.cpp -o test`

Expected result:
clang should compile the file

Actual result:

clang crashes with the assertion

```
clang++: /path/to/llvm/repo/llvm-project/clang/lib/AST/Expr.cpp:1836: bool clang::CastExpr::CastConsistency() const: Assertion `!getType()->isBooleanType() && "unheralded conversion to bool"' failed.
```

The full stacktrace is in the attached stacktrace.txt.

(I had to change the extension of the `.cpp` file and the `.sh` file as GitHub doesn't support those file type extensions as attachments)

[stacktrace.txt](https://github.com/llvm/llvm-project/files/9124964/stacktrace.txt)
[test-f893c2.cpp.txt](https://github.com/llvm/llvm-project/files/9124968/test-f893c2.cpp.txt)
[test-f893c2.sh.txt](https://github.com/llvm/llvm-project/files/9124969/test-f893c2.sh.txt)


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVVtvqzgQ_jXkZRRkzCXwwEOSJrtH6rZSW-3rkTFDYEtsZJuedn_9jiFN0ujsSiudyMIwnvnm9o1T6fqj7Pu3I0h9PHYOvkEr3hBki_IVa9Cjgx8tGgTXdhZoVUa_ooKA50o7UCjRWmG6_oM0yE6MFgNeBPEaEpGwRuRcshWPcxQ8R5ZEtWTI8yppeJHGmL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