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

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 09:40:30 PDT 2025


https://github.com/rnk commented:

I'm OK with this, but I feel like this is creating scope creep. Now we have a special Wdeprecated-declarations carveouts for switches, but if you unpack the switch into if / else chain comparisons, you get deprecation warnings. Should we disable deprecation warnings that directly compare enumerators? I wouldn't want to expand scope that much.

It is possible to write code that avoids mentioning the deprecated enum (add a default, and/or fallthrough code) and silences -Wreturn-type, so I have a soft preference for going back to the old version.

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


More information about the cfe-commits mailing list