Fixed #1305 (False positive: The function 'x' can be const when indirectly calling a non-const member)
This commit is contained in:
parent
9a6b450501
commit
aab05524e5
|
@ -1466,7 +1466,7 @@ void CheckClass::checkConst()
|
|||
}
|
||||
|
||||
// function call..
|
||||
else if (Token::Match(tok, "%var% ("))
|
||||
else if (Token::Match(tok3, "%var% ("))
|
||||
{
|
||||
isconst = false;
|
||||
break;
|
||||
|
|
|
@ -1546,6 +1546,14 @@ private:
|
|||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// functions with a function call can't be const..
|
||||
checkConst("class foo\n"
|
||||
"{\n"
|
||||
"public:\n"
|
||||
" int x;\n"
|
||||
" void b() { a(); }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue