diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index e49db3fba..4fc010646 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -237,6 +237,8 @@ void CheckStl::iterators() bool inconclusiveType=false; if (!isIterator(var, inconclusiveType)) continue; + if (inconclusiveType && !mSettings->inconclusive) + continue; const unsigned int iteratorId = var->declarationId(); diff --git a/test/teststl.cpp b/test/teststl.cpp index 25d2b4e99..35e12480d 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1837,7 +1837,7 @@ private: "int foo() {\n" " iterator i;\n" " return i.foo();;\n" - "}"); + "}", true); ASSERT_EQUALS("", errout.str()); check("class iterator {\n" @@ -1848,7 +1848,7 @@ private: "int foo() {\n" " iterator i;\n" " return i.foo();;\n" - "}"); + "}", true); ASSERT_EQUALS("[test.cpp:8]: (error, inconclusive) Invalid iterator 'i' used.\n", errout.str()); } @@ -1859,7 +1859,7 @@ private: " {\n" " }\n" " }\n" - "}"); + "}", true); ASSERT_EQUALS("", errout.str()); } @@ -3172,7 +3172,7 @@ private: " iterator it; \n" " it->m_place = 0;\n" " return it; \n" - "}\n"); + "}\n", true); ASSERT_EQUALS("[test.cpp:18]: (error, inconclusive) Invalid iterator 'it' used.\n", errout.str()); }