File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ class TestOther : public TestFixture {
165165 TEST_CASE (checkSuspiciousSemicolon1);
166166 TEST_CASE (checkSuspiciousSemicolon2);
167167 TEST_CASE (checkSuspiciousSemicolon3);
168+ TEST_CASE (checkSuspiciousComparison);
168169
169170 TEST_CASE (checkInvalidFree);
170171
@@ -6698,6 +6699,19 @@ class TestOther : public TestFixture {
66986699 ASSERT_EQUALS (" " , errout.str ());
66996700 }
67006701
6702+ void checkSuspiciousComparison () {
6703+ checkP (" void f(int a, int b) {\n "
6704+ " a > b;\n "
6705+ " }" );
6706+ ASSERT_EQUALS (" [test.cpp:2]: (warning, inconclusive) Found suspicious operator '>'\n " , errout.str ());
6707+
6708+ checkP (" void f() {\n " // #10607
6709+ " for (auto p : m)\n "
6710+ " std::vector<std::pair<std::string, std::string>> k;\n "
6711+ " }" );
6712+ ASSERT_EQUALS (" " , errout.str ());
6713+ }
6714+
67016715 void checkInvalidFree () {
67026716 check (" void foo(char *p) {\n "
67036717 " char *a; a = malloc(1024);\n "
You can’t perform that action at this time.
0 commit comments