[clang] [Clang] add additional tests for -Wshift-bool (PR #130339)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 7 12:12:06 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Oleksandr T. (a-tarasyuk)
<details>
<summary>Changes</summary>
Fixes https://github.com/llvm/llvm-project/pull/127336#pullrequestreview-2665950553
---
Full diff: https://github.com/llvm/llvm-project/pull/130339.diff
1 Files Affected:
- (modified) clang/test/Sema/shift-bool.cpp (+3)
``````````diff
diff --git a/clang/test/Sema/shift-bool.cpp b/clang/test/Sema/shift-bool.cpp
index a17a0e0ad9e7d..efaca65aacaed 100644
--- a/clang/test/Sema/shift-bool.cpp
+++ b/clang/test/Sema/shift-bool.cpp
@@ -3,6 +3,7 @@
void t() {
int x = 10;
bool y = true;
+ int z = 1;
bool a = y << x;
bool b = y >> x; // expected-warning {{right shifting a 'bool' implicitly converts it to 'int'}}
@@ -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'}}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/130339
More information about the cfe-commits
mailing list