Fixed TODO in checkAssignBoolToFloat
This commit is contained in:
parent
e6a394d514
commit
d42275c5f1
|
@ -484,9 +484,9 @@ void CheckBool::checkAssignBoolToFloat()
|
|||
for (std::size_t i = 0; i < functions; ++i) {
|
||||
const Scope * scope = symbolDatabase->functionScopes[i];
|
||||
for (const Token* tok = scope->classStart; tok != scope->classEnd; tok = tok->next()) {
|
||||
if (Token::Match(tok, "!!* %var% = %bool% ;")) {
|
||||
const Variable * const var = symbolDatabase->getVariableFromVarId(tok->next()->varId());
|
||||
if (var && var->isFloatingType())
|
||||
if (Token::Match(tok, "%var% =")) {
|
||||
const Variable * const var = symbolDatabase->getVariableFromVarId(tok->varId());
|
||||
if (var && var->isFloatingType() && astIsBool(tok->next()->astOperand2()))
|
||||
assignBoolToFloatError(tok->next());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ private:
|
|||
check("void foo3() {\n"
|
||||
" long double d = (2>1);\n"
|
||||
"}");
|
||||
TODO_ASSERT_EQUALS("[test.cpp:2]: (style) Boolean value assigned to floating point variable.\n", "", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Boolean value assigned to floating point variable.\n", errout.str());
|
||||
|
||||
// stability - don't crash:
|
||||
check("void foo4() {\n"
|
||||
|
|
Loading…
Reference in New Issue