[clang-tools-extra] [clang-tidy] Fix a false positive when converting a bool to a signed integer type (PR #191696)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 12 23:24:43 PDT 2026


================
@@ -355,4 +355,12 @@ void typedef_context() {
   // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: narrowing conversion from 'myint64_t' (aka 'long long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]
 }
 
+void testBoolToSignedType() {
+  bool b = true;
----------------
vbvictor wrote:

Can we add these tests as well if not already present
```cpp
  auto c1 = static_cast<char>(b);
  auto c2 = (char)b;
```

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


More information about the cfe-commits mailing list