Use boolean flag to avoid comparison duplication

This commit is contained in:
Dmitry-Me 2014-07-18 13:31:31 +04:00
parent 6c44c20183
commit fae9d975cf
1 changed files with 5 additions and 2 deletions

View File

@ -1590,13 +1590,16 @@ void CheckClass::checkConst()
} else if (Token::Match(previous->previous(), "*|& >")) {
const Token *temp = previous;
bool foundConst = false;
while (!Token::Match(temp->previous(), ";|}|{|public:|protected:|private:")) {
temp = temp->previous();
if (temp->str() == "const")
if (temp->str() == "const") {
foundConst = true;
break;
}
}
if (temp->str() != "const")
if (!foundConst)
continue;
} else if (func->isOperator && Token::Match(previous, ";|{|}|public:|private:|protected:")) { // Operator without return type: conversion operator
const std::string& opName = func->tokenDef->str();