Skip to content

Commit bb84926

Browse files
committed
Check for designated initializer
1 parent 9adab8a commit bb84926

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/checkautovariables.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,8 @@ void CheckAutoVariables::checkVarLifetimeScope(const Token * start, const Token
612612
if (tokvalue->exprId() == tok->exprId() && !(tok->variable() && tok->variable()->isArray()) &&
613613
!astIsContainerView(tok->astParent()))
614614
continue;
615-
if (tokvalue->str() == "=" && Token::simpleMatch(tokvalue->astOperand1(), "."))
616-
tokvalue = tokvalue->astOperand2();
615+
if (tokvalue->str() == "=" && Token::simpleMatch(tokvalue->astOperand1(), ".") && !tokvalue->astOperand1()->astOperand2())
616+
tokvalue = tokvalue->astOperand2(); // designated initializer
617617
if ((tokvalue->variable() && !isEscapedReference(tokvalue->variable()) &&
618618
isInScope(tokvalue->variable()->nameToken(), scope)) ||
619619
isDeadTemporary(tokvalue, nullptr, mSettings->library)) {

0 commit comments

Comments
 (0)