diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 80844b6ad..b3f7f0593 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -1347,7 +1347,7 @@ void CheckStl::uselessCalls() else if (Token::simpleMatch(tok->linkAt(2)->tokAt(-2), ", 0 )")) uselessCallsSubstrError(tok, true); } else if (Token::Match(tok, "[{}:;] %var% . empty ( ) ;") && style) - uselessCallsEmptyError(tok); + uselessCallsEmptyError(tok->next()); } } diff --git a/test/teststl.cpp b/test/teststl.cpp index 91882b8dd..274a84a2e 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1868,7 +1868,7 @@ private: " v.empty();\n" " return v.empty();\n" "}"); - ASSERT_EQUALS("[test.cpp:1]: (warning) Useless call of function 'empty()'. Did you intend to call 'clear()' instead?\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2]: (warning) Useless call of function 'empty()'. Did you intend to call 'clear()' instead?\n", errout.str()); } };