[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu May 22 03:59:43 PDT 2025


AaronBallman wrote:

> Thanks Aaron, that's a good example.
> 
> This is a pickle; it doesn't seem like there's an obviously Right Solution(tm) here.

That's the same conclusion I'm coming to. These situations are kind of mutually exclusive.

> I think we're agreeing on the first part, that unhandled deprecated enums should trigger the "not covered" warning.

Yup!

> Some users will prefer to handle that with a `default:` to avoid using the deprecated enum, while others will want to handle the enum explicitly and suppress the warning.
> 
> Corentin's flag suggestion seems like the best way to satisfy both camps. I've updated the PR.

I agree, thank you for heading that direction (and good suggestion @cor3ntin)!

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


More information about the cfe-commits mailing list