diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 16542edd8..399a83e8f 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2047,7 +2047,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool& if (lhs->previous()->variable()->typeStartToken()->strAt(-1) != "const" && lhs->previous()->variable()->isPointer()) return false; } - } else if (lhs->str() == ":" && lhs->astParent() && lhs->astParent()->str() == "(" && tok1->strAt(1) == ")") { // range-based for-loop (C++11) + } else if (lhs->str() == ":" && lhs->astParent() && lhs->astParent()->str() == "(") { // range-based for-loop (C++11) // TODO: We could additionally check what is done with the elements to avoid false negatives. Here we just rely on "const" keyword being used. if (lhs->astParent()->strAt(1) != "const") return false;