From fae9d975cf7abf69c49bddae83e728cf4e03c02c Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Fri, 18 Jul 2014 13:31:31 +0400 Subject: [PATCH] Use boolean flag to avoid comparison duplication --- lib/checkclass.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 12d74dd74..96b2b84ca 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -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();