[clang] Stop double-diagnosing explicit convert operator in switch condition (PR #89142)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 06:10:25 PDT 2024


erichkeane wrote:

> I'm having second thoughts about leveraging recovery expressions as a side-band mechanism to de-duplicate diagnostics, because not modeling things properly in AST might backfire in the future. But I don't have anything better on my mind, so I don't want to block the progress of this PR.

This is a case where we previously would use `ExprError`.  Typically, we don't include 'incorrect' expressions in the AST, as it results in us trying to instantiate them (like we see here).  The duplicate diagnostics is a side-effect of doing that wrong.

The `RecoveryExpr` is, IMO, a half decent way to actually model things properly in the AST despite them having an error.

https://github.com/llvm/llvm-project/pull/89142


More information about the cfe-commits mailing list