brintos

brintos / llvm-project-archived public Read only

0
0
Text · 662 B · 1502b80 Raw
30 lines · cpp
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 6template <typename C>7struct OutputStream {8  OutputStream &operator<<(C);9};10 11template <typename C>12struct foo {13  typedef OutputStream<C> stream_type;14  foo(stream_type &o) {15    o << 'x'; // warning occurred here, fixed now16  }17};18 19void bar(OutputStream<signed char> &o) {20  foo<signed char> f(o);21}22 23void 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 operator29}30