diff --git a/lib/checkstring.cpp b/lib/checkstring.cpp index 90784e3bcb8..055dac64278 100644 --- a/lib/checkstring.cpp +++ b/lib/checkstring.cpp @@ -303,7 +303,7 @@ void CheckString::checkIncorrectStringCompare() incorrectStringCompareError(tok->next(), "substr", end->strAt(1)); } } - } else if (Token::Match(tok, "%str%|%char%") && + } else if (Token::Match(tok, "%str%|%char%") && isUsedAsBool(tok) && !isMacroUsage(tok)) incorrectStringBooleanError(tok, tok->str());