[clang] [Clang] add additional tests for -Wshift-bool (PR #130339)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 10 09:43:28 PDT 2025
================
@@ -22,4 +23,6 @@ void t() {
if ((y << 1) != 0) { }
if ((y >> 1) != 0) { } // expected-warning {{right shifting a 'bool' implicitly converts it to 'int'}}
+
+ bool k = (x < z) >> 1; // expected-warning {{right shifting a 'bool' implicitly converts it to 'int'}}
----------------
AaronBallman wrote:
It would be good to have this as a test in C as well; it should not diagnose there because `x < z` results in an `int`, not a `bool`.
https://github.com/llvm/llvm-project/pull/130339
More information about the cfe-commits
mailing list