Skip to content

Commit d75f8dc

Browse files
Update astutils.cpp
1 parent 922bb96 commit d75f8dc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/astutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,7 +2628,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings &settings,
26282628
if (!tok->isMutableExpr())
26292629
return false;
26302630

2631-
if (indirect == 0 && isConstVarExpression(tok))
2631+
if (isConstVarExpression(tok))
26322632
return false;
26332633

26342634
const Token *tok2 = tok;
@@ -3369,7 +3369,7 @@ bool isConstVarExpression(const Token *tok, const std::function<bool(const Token
33693369
if (!tok)
33703370
return false;
33713371
if (tok->str() == "?" && tok->astOperand2() && tok->astOperand2()->str() == ":") // ternary operator
3372-
return isConstVarExpression(tok->astOperand2()->astOperand1()) && isConstVarExpression(tok->astOperand2()->astOperand2()); // left and right of ":"
3372+
return isConstVarExpression(tok->astOperand2()->astOperand1()) || isConstVarExpression(tok->astOperand2()->astOperand2()); // left and right of ":"
33733373
if (skipPredicate && skipPredicate(tok))
33743374
return false;
33753375
if (Token::simpleMatch(tok->previous(), "sizeof ("))

0 commit comments

Comments
 (0)