Skip to content

Commit

Permalink
Fixed danmar#6096: bool is an integral type, but there is no portabil…
Browse files Browse the repository at this point in the history
…ity issue if a pointer is assigned to a bool.
  • Loading branch information
PKEuS committed Jan 2, 2015
1 parent 274e1a8 commit 417f42f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/check64bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static bool isaddr(const Variable *var)
/** Is given variable an integer variable */
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()
Expand Down
6 changes: 6 additions & 0 deletions test/test64bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ class Test64BitPortability : public TestFixture {
" return 6 + p[2] * 256;\n"
"}");
ASSERT_EQUALS("", errout.str());

check("int foo(int *p) {\n" // #6096
" bool a = p;\n"
" return a;\n"
"}");
ASSERT_EQUALS("", errout.str());
}

void structmember() {
Expand Down

0 comments on commit 417f42f

Please sign in to comment.