Skip to content

Commit 83c8136

Browse files
Update astutils.cpp
1 parent 2c5b872 commit 83c8136

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/astutils.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,11 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti
26172617
return false;
26182618
}
26192619

2620+
static bool hasOverloadedMemberAccess(const Token* varTok)
2621+
{
2622+
return !varTok || !varTok->variable() || !varTok->variable()->valueType() || varTok->variable()->valueType()->pointer == 0;
2623+
}
2624+
26202625
bool isVariableChanged(const Token *tok, int indirect, const Settings &settings, int depth)
26212626
{
26222627
if (!isMutableExpression(tok))
@@ -2631,7 +2636,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings &settings,
26312636
(Token::simpleMatch(tok2->astParent(), ".") && !Token::Match(tok2->astParent()->astParent(), "[(,]")) ||
26322637
(tok2->astParent() && tok2->astParent()->isUnaryOp("&") && Token::simpleMatch(tok2->astParent()->astParent(), ".") && tok2->astParent()->astParent()->originalName()=="->") ||
26332638
(Token::simpleMatch(tok2->astParent(), "[") && tok2 == tok2->astParent()->astOperand1())) {
2634-
if (tok2->astParent() && (tok2->astParent()->isUnaryOp("*") || (astIsLHS(tok2) && tok2->astParent()->originalName() == "->")))
2639+
if (tok2->astParent() && (tok2->astParent()->isUnaryOp("*") || (astIsLHS(tok2) && tok2->astParent()->originalName() == "->") && !hasOverloadedMemberAccess(tok2->astOperand2())))
26352640
derefs++;
26362641
if (derefs > indirect)
26372642
break;

0 commit comments

Comments
 (0)