[clang] [Clang] add -Wshift-bool warning to handle shifting of bool (PR #127336)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 5 10:57:38 PST 2025


================
@@ -7141,6 +7141,9 @@ def warn_shift_result_sets_sign_bit : Warning<
   "signed shift result (%0) sets the sign bit of the shift expression's "
   "type (%1) and becomes negative">,
   InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
+def warn_shift_bool : Warning<
+  "right shifting a `bool` implicitly converts it to 'int'">,
----------------
AaronBallman wrote:

```suggestion
  "right shifting a 'bool' implicitly converts it to 'int'">,
```

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


More information about the cfe-commits mailing list