From 0b6948a805611bdf896e816b99d738724d9c963e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 15 Oct 2010 18:11:41 +0200 Subject: [PATCH] Fixed #2101 (list in vector iterator usage) --- lib/checkstl.cpp | 2 -- test/teststl.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 5ee3535e4..859b62e47 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -306,8 +306,6 @@ private: break; else if (token->str() == "=") token = 0; - else - token = token->previous(); } if (token) diff --git a/test/teststl.cpp b/test/teststl.cpp index 4d9c02238..0503b567f 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -384,6 +384,16 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + // #2101 + check("void f(vector< list > &ints, unsigned int i)\n" + "{\n" + " list::iterator it;\n" + " for(it = ints[i].begin(); it != ints[i].end(); it++) {\n" + " if (*it % 2)\n" + " it = ints[i].erase(it);\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void erase2()