From d42275c5f1c2f7faae19849facd2f267bcbc3897 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sat, 24 May 2014 20:02:12 +0200 Subject: [PATCH] Fixed TODO in checkAssignBoolToFloat --- lib/checkbool.cpp | 6 +++--- test/testbool.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/checkbool.cpp b/lib/checkbool.cpp index 40579e462..c6f91cc63 100644 --- a/lib/checkbool.cpp +++ b/lib/checkbool.cpp @@ -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()); } } diff --git a/test/testbool.cpp b/test/testbool.cpp index 56a5400ba..1f3be7600 100644 --- a/test/testbool.cpp +++ b/test/testbool.cpp @@ -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"