Fixed #4642 (False positive: Returning an address value in a function with integer return type is not portable. (not returning address))
This commit is contained in:
parent
3d1cdd0eec
commit
9d88cc63e8
|
@ -77,7 +77,9 @@ void Check64BitPortability::pointerassignment()
|
|||
else if (Token::Match(tok2, "%type% (")) {
|
||||
type = NO;
|
||||
break;
|
||||
} else if (tok2->str() == ";")
|
||||
} else if (type == PTR && Token::simpleMatch(tok2, "."))
|
||||
type = NO; // Reset after pointer reference, see #4642
|
||||
else if (tok2->str() == ";")
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -180,6 +180,14 @@ private:
|
|||
" return a + 1 - b;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct s {\n" // 4642
|
||||
" int i;\n"
|
||||
"};\n"
|
||||
"int func(struct s *p) {\n"
|
||||
" return 1 + p->i;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue