Index: clang-tidy/hicpp/SignedBitwiseCheck.cpp =================================================================== --- clang-tidy/hicpp/SignedBitwiseCheck.cpp +++ clang-tidy/hicpp/SignedBitwiseCheck.cpp @@ -27,7 +27,9 @@ binaryOperator(allOf(anyOf(hasOperatorName("|"), hasOperatorName("&"), hasOperatorName("^"), hasOperatorName("<<"), hasOperatorName(">>")), - hasEitherOperand(SignedIntegerOperand))) + hasEitherOperand(SignedIntegerOperand), + hasLHS(hasType(isInteger())), + hasRHS(hasType(isInteger())))) .bind("binary_signed"), this); Index: test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp =================================================================== --- /dev/null +++ test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp @@ -0,0 +1,26 @@ +// RUN: %check_clang_tidy %s hicpp-signed-bitwise %t -- -- -std=c++11 + +template +struct OutputStream { + OutputStream &operator<<(C); +}; + +template +struct foo { + typedef OutputStream stream_type; + foo(stream_type &o) { + o << 'x'; // warning occured here, fixed now + } +}; + +void bar(OutputStream &o) { + foo f(o); +} + +void silence_lit() { + int SResult; + int SValue = 42; + + SResult = SValue & 1; + // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use of a signed integer operand with a binary bitwise operator +} Index: test/clang-tidy/hicpp-signed-bitwise.cpp =================================================================== --- test/clang-tidy/hicpp-signed-bitwise.cpp +++ test/clang-tidy/hicpp-signed-bitwise.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s hicpp-signed-bitwise %t -- -- -std=c++11 -target x86_64-unknown-unknown +// RUN: %check_clang_tidy %s hicpp-signed-bitwise %t -- -- -std=c++11 // These could cause false positives and should not be considered. struct StreamClass {