[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 15 03:52:43 PDT 2025


================
@@ -4401,6 +4401,11 @@ def warn_impcast_different_enum_types : Warning<
 def warn_impcast_int_to_enum : Warning<
   "implicit conversion from %0 to enumeration type %1 is invalid in C++">,
   InGroup<ImplicitIntToEnumCast>, DefaultIgnore;
+
+def note_no_implicit_conversion_for_scoped_enum
+    : Note<"no implicit conversion for scoped enum; consider casting to "
----------------
zwuis wrote:

Oops I didn't express clearly enough. I didn't want fix-it to add `std::to_underlying` because adding `#include <header>` by fix-it is not supported currently. I have no ideas and will defer to other reviewers.

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


More information about the cfe-commits mailing list