[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 09:18:53 PDT 2024


erichkeane wrote:

> > I've only ever seen that used in regards to the `RecoveryExpr`, so I think I am?
> 
> It’s used in a few other places from what I can tell (e.g. see `InitListExpr::markError()`); I think the result is the same either way (i.e. `containsErrors()` ends up returning `true`).
> 
> I was looking around a bit and also just found this comment here:
> 
> https://github.com/llvm/llvm-project/blob/215eee60497489ae0cc7cc78c0d8b8270e057a70/clang/lib/Sema/SemaExpr.cpp#L3734-L3739
> 
> So I suppose there is at least some prededent for using `RecoveryExpr` to suppress diagnostics.
> 
> I don’t have too much experience with either, but at least intuitively, `ExprDependence::Error` sounds like it would make sense here, because if not for cases like this one then what is it actually for I wonder?

I was looking into that, it doesn't seem to prevent being used in instantiation like `RecoveryExpr` does.  I DO note that `RecoveryExpr` DOES contain the original AST nodes, so it isn't like we're losing anything.

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


More information about the cfe-commits mailing list