From c27ecf5aeb945bd6340c8cf7a583b234ce4c54d9 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Fri, 25 Mar 2011 23:22:28 -0400 Subject: [PATCH] only break when we know we are inc/dec a member variable in CheckClass::checkConstFunc --- lib/checkclass.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 7adcbb623..3edd83663 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1545,23 +1545,31 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Token *tok) tok1->previous()->str() != "return") { if (isMemberVar(scope, tok1->previous())) + { isconst = false; + break; + } } // var[...]++ and var[...]-- else if (tok1->previous()->str() == "]") { if (isMemberVar(scope, tok1->previous()->link()->previous())) + { isconst = false; + break; + } } // ++var and --var else if (Token::Match(tok1->next(), "%var%")) { if (isMemberVar(scope, tok1->next())) + { isconst = false; + break; + } } - break; } // function call..