Fixed #6096: bool is an integral type, but there is no portability issue if a pointer is assigned to a bool.

This commit is contained in:
PKEuS 2015-01-02 21:07:02 +01:00
parent 274e1a838a
commit 417f42f732
2 changed files with 7 additions and 1 deletions

View File

@ -39,7 +39,7 @@ static bool isaddr(const Variable *var)
/** Is given variable an integer variable */ /** Is given variable an integer variable */
static bool isint(const Variable *var) static bool isint(const Variable *var)
{ {
return (var && var->isIntegralType() && !var->isArrayOrPointer()); return (var && var->isIntegralType() && !var->isArrayOrPointer() && var->typeStartToken()->str() != "bool");
} }
void Check64BitPortability::pointerassignment() void Check64BitPortability::pointerassignment()

View File

@ -100,6 +100,12 @@ private:
" return 6 + p[2] * 256;\n" " return 6 + p[2] * 256;\n"
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("int foo(int *p) {\n" // #6096
" bool a = p;\n"
" return a;\n"
"}");
ASSERT_EQUALS("", errout.str());
} }
void structmember() { void structmember() {