add test for #3110 (false positve: style) Boolean result is used in bitwise operation. Clarify expression with parentheses)
This commit is contained in:
parent
f3193ef611
commit
302daeb9bd
|
@ -120,6 +120,7 @@ private:
|
|||
TEST_CASE(clarifyCondition1); // if (a = b() < 0)
|
||||
TEST_CASE(clarifyCondition2); // if (a & b == c)
|
||||
TEST_CASE(clarifyCondition3); // if (! a & b)
|
||||
TEST_CASE(clarifyCondition4); // ticket #3110
|
||||
TEST_CASE(bitwiseOnBoolean); // if (bool & bool)
|
||||
|
||||
TEST_CASE(incorrectStringCompare);
|
||||
|
@ -2837,6 +2838,22 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void clarifyCondition4() // ticket #3110
|
||||
{
|
||||
check("typedef double SomeType;\n"
|
||||
"typedef std::pair<std::string,SomeType> PairType;\n"
|
||||
"struct S\n"
|
||||
"{\n"
|
||||
" bool operator()\n"
|
||||
" ( PairType const & left\n"
|
||||
" , PairType const & right) const\n"
|
||||
" {\n"
|
||||
" return (left.first < right.first);\n"
|
||||
" }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void bitwiseOnBoolean() // 3062
|
||||
{
|
||||
check("void f(_Bool a, _Bool b) {\n"
|
||||
|
|
Loading…
Reference in New Issue