File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3675,7 +3675,7 @@ class TestCondition : public TestFixture {
36753675 " f ? result = 42 : ret = -1;\n "
36763676 " return ret;\n "
36773677 " }" );
3678- ASSERT_EQUALS (" " , errout_str ());
3678+ ASSERT_EQUALS (" [test.cpp:4:9]: (style) Condition 'f' is always false [knownConditionTrueFalse] \n " , errout_str ());
36793679
36803680 check (" int f(void *handle) {\n "
36813681 " if (!handle) return 0;\n "
@@ -6227,6 +6227,20 @@ class TestCondition : public TestFixture {
62276227 check (" enum E { E1 = 1, E2 = 2 };\n "
62286228 " void f(int i) { if (i == E1 || E2) {} }\n " );
62296229 ASSERT_EQUALS (" [test.cpp:2:29]: (style) Condition 'i==E1||E2' is always true [knownConditionTrueFalse]\n " , errout_str ());
6230+
6231+ check (" void f(bool a, bool b) {\n " // #11614
6232+ " if (b) {\n "
6233+ " bool x = !b || a;\n "
6234+ " }\n "
6235+ " }\n "
6236+ " void g(bool a, bool b) {\n "
6237+ " if (!b) {\n "
6238+ " bool x = a || b;\n "
6239+ " }\n "
6240+ " }" );
6241+ ASSERT_EQUALS (" [test.cpp:2:9] -> [test.cpp:3:18]: (style) Condition '!b' is always false [knownConditionTrueFalse]\n "
6242+ " [test.cpp:7:9] -> [test.cpp:8:23]: (style) Condition 'b' is always false [knownConditionTrueFalse]\n " ,
6243+ errout_str ());
62306244 }
62316245
62326246 void pointerAdditionResultNotNull () {
You can’t perform that action at this time.
0 commit comments