Fix issue 8743: FP when derefencing iterators (#1376)
This commit is contained in:
parent
90a29d986b
commit
eb07280075
|
@ -457,6 +457,8 @@ static const Token * getIteratorExpression(const Token * tok)
|
|||
{
|
||||
if (!tok)
|
||||
return nullptr;
|
||||
if (tok->isUnaryOp("*"))
|
||||
return nullptr;
|
||||
if (!tok->isName()) {
|
||||
const Token *iter1 = getIteratorExpression(tok->astOperand1());
|
||||
if (iter1)
|
||||
|
|
|
@ -709,6 +709,13 @@ private:
|
|||
" if (begin(a).x == begin(b).x) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f() {\n"
|
||||
" std::list<int*> a;\n"
|
||||
" std::list<int*> b;\n"
|
||||
" if (*a.begin() == *b.begin()) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void iteratorSameExpression() {
|
||||
|
|
Loading…
Reference in New Issue