File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2999,7 +2999,7 @@ void CheckOther::checkNegativeBitwiseShift()
29992999 // don't warn if lhs is a class. this is an overloaded operator then
30003000 if (tok->isCpp ()) {
30013001 const ValueType * lhsType = tok->astOperand1 ()->valueType ();
3002- if (!lhsType || !lhsType->isIntegral ())
3002+ if (!lhsType || !lhsType->isIntegral () || lhsType-> pointer )
30033003 continue ;
30043004 }
30053005
Original file line number Diff line number Diff line change @@ -9113,6 +9113,13 @@ class TestOther : public TestFixture {
91139113 " [test.cpp:2]: (error) Shifting by a negative value is undefined behaviour\n "
91149114 " [test.cpp:3]: (portability) Shifting a negative value is technically undefined behaviour\n "
91159115 " [test.cpp:4]: (portability) Shifting a negative value is technically undefined behaviour\n " , errout_str ());
9116+
9117+ check (" void f(int i) {\n " // #12916
9118+ " if (i < 0) {\n "
9119+ " g(\" abc\" << i);\n "
9120+ " }\n "
9121+ " }\n " );
9122+ ASSERT_EQUALS (" " , errout_str ());
91169123 }
91179124
91189125 void incompleteArrayFill () {
You can’t perform that action at this time.
0 commit comments