Skip to content

Commit 5a36332

Browse files
Update checkother.cpp
1 parent e1053db commit 5a36332

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

lib/checkother.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,13 +1943,16 @@ void CheckOtherImpl::checkConstPointer()
19431943
if (deref == MEMBER) {
19441944
if (!gparent)
19451945
continue;
1946-
if (parent->astOperand2()) {
1947-
if (parent->astOperand2()->function() && parent->astOperand2()->function()->isConst())
1946+
const Token* funcParent = parent;
1947+
while (Token::simpleMatch(funcParent->astParent(), "."))
1948+
funcParent = funcParent->astParent();
1949+
if (funcParent->astOperand2()) {
1950+
if (funcParent->astOperand2()->function() && funcParent->astOperand2()->function()->isConst())
19481951
continue;
1949-
if (mSettings.library.isFunctionConst(parent->astOperand2()))
1952+
if (mSettings.library.isFunctionConst(funcParent->astOperand2()))
19501953
continue;
1951-
if (parent->astOperand2()->varId()) {
1952-
if (gparent->str() == "?" && astIsLHS(parent))
1954+
if (funcParent->astOperand2()->varId()) {
1955+
if (gparent->str() == "?" && astIsLHS(funcParent))
19531956
continue;
19541957
}
19551958
}

0 commit comments

Comments
 (0)