diff --git a/lib/astutils.cpp b/lib/astutils.cpp index e5c31c01f72..1a672ef000b 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -1529,7 +1529,7 @@ static bool astIsBoolLike(const Token* tok) bool isSameExpression(bool macro, const Token *tok1, const Token *tok2, const Library& library, bool pure, bool followVar, ErrorPath* errors) { - if (tok1 == nullptr && tok2 == nullptr) + if (tok1 == tok2) return true; if (tok1 == nullptr || tok2 == nullptr) return false; diff --git a/test/teststl.cpp b/test/teststl.cpp index eeb3058e221..48f4f09b451 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -2208,6 +2208,12 @@ class TestStl : public TestFixture { " if (it != N::v.end()) {}\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("void f(void* p) {\n" // #12445 + " std::vector&v = *(std::vector*)(p);\n" + " v.erase(v.begin(), v.end());\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); } void eraseIteratorOutOfBounds() { diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index 3358082d081..7a4996f9bc2 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -2910,9 +2910,7 @@ class TestUnusedVar : public TestFixture { " for (int i = 0; i < 10; )\n" " a[i++] = 0;\n" "}"); - TODO_ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a' is assigned a value that is never used.\n", - "", - errout_str()); + ASSERT_EQUALS("[test.cpp:5]: (style) Variable 'a[i++]' is assigned a value that is never used.\n", errout_str()); } void localvar10() {