| 1 |
// RUN: %check_clang_tidy %s hicpp-signed-bitwise %t -- |
| 2 |
|
| 3 |
// Note: this test expects no diagnostics, but FileCheck cannot handle that, |
| 4 |
// hence the use of | count 0. |
| 5 |
|
| 6 |
template <typename C> |
| 7 |
struct OutputStream { |
| 8 |
OutputStream &operator<<(C); |
| 9 |
}; |
| 10 |
|
| 11 |
template <typename C> |
| 12 |
struct foo { |
| 13 |
typedef OutputStream<C> stream_type; |
| 14 |
foo(stream_type &o) { |
| 15 |
o << 'x'; // warning occurred here, fixed now |
| 16 |
} |
| 17 |
}; |
| 18 |
|
| 19 |
void bar(OutputStream<signed char> &o) { |
| 20 |
foo<signed char> f(o); |
| 21 |
} |
| 22 |
|
| 23 |
void silence_lit() { |
| 24 |
int SValue = 42; |
| 25 |
int SResult; |
| 26 |
|
| 27 |
SResult = SValue & 1; |
| 28 |
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use of a signed integer operand with a binary bitwise operator |
| 29 |
} |