parent
212d2141d3
commit
a6b7a8c1cc
|
@ -1481,7 +1481,7 @@ bool isUsedAsBool(const Token* const tok, const Settings* settings)
|
|||
return true;
|
||||
if (isForLoopCondition(tok))
|
||||
return true;
|
||||
if (!Token::Match(parent, "%cop%")) {
|
||||
if (!Token::Match(parent, "%cop%") && !(parent->str() == "(" && tok == parent->astOperand1())) {
|
||||
if (parent->str() == "," && parent->isInitComma())
|
||||
return false;
|
||||
std::vector<ValueType> vtParents = getParentValueTypes(tok, settings);
|
||||
|
|
|
@ -11640,6 +11640,12 @@ private:
|
|||
" if (dynamic_cast<D*>(b)) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("bool (*ptr)();\n" // #12170
|
||||
"void f() {\n"
|
||||
" if (!ptr || !ptr()) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue