@@ -463,9 +463,9 @@ static int getPointerDepth(const Token *tok)
463463 return n;
464464}
465465
466- static bool isDeadTemporary (const Token* tok, const Token* expr, const Library* library)
466+ static bool isDeadTemporary (const Token* tok, const Token* expr, const Library& library)
467467{
468- if (!isTemporary (tok, library))
468+ if (!isTemporary (tok, & library))
469469 return false ;
470470 if (expr) {
471471 if (!precedes (nextAfterAstRightmostLeaf (tok->astTop ()), nextAfterAstRightmostLeaf (expr->astTop ())))
@@ -562,7 +562,7 @@ void CheckAutoVariables::checkVarLifetimeScope(const Token * start, const Token
562562 errorReturnReference (tok, lt.errorPath , lt.inconclusive );
563563 break ;
564564 }
565- if (isDeadTemporary (lt.token , nullptr , & mSettings ->library )) {
565+ if (isDeadTemporary (lt.token , nullptr , mSettings ->library )) {
566566 errorReturnTempReference (tok, lt.errorPath , lt.inconclusive );
567567 break ;
568568 }
@@ -584,7 +584,7 @@ void CheckAutoVariables::checkVarLifetimeScope(const Token * start, const Token
584584 if (!printInconclusive && lt.inconclusive )
585585 continue ;
586586 const Token * tokvalue = lt.token ;
587- if (isDeadTemporary (tokvalue, tok, & mSettings ->library )) {
587+ if (isDeadTemporary (tokvalue, tok, mSettings ->library )) {
588588 errorDanglingTempReference (tok, lt.errorPath , lt.inconclusive );
589589 break ;
590590 }
@@ -614,15 +614,15 @@ void CheckAutoVariables::checkVarLifetimeScope(const Token * start, const Token
614614 continue ;
615615 if ((tokvalue->variable () && !isEscapedReference (tokvalue->variable ()) &&
616616 isInScope (tokvalue->variable ()->nameToken (), scope)) ||
617- isDeadTemporary (tokvalue, nullptr , & mSettings ->library )) {
617+ isDeadTemporary (tokvalue, nullptr , mSettings ->library )) {
618618 errorReturnDanglingLifetime (tok, &val);
619619 break ;
620620 }
621621 } else if (tokvalue->variable () && isDeadScope (tokvalue->variable ()->nameToken (), tok->scope ())) {
622622 errorInvalidLifetime (tok, &val);
623623 break ;
624624 } else if (!tokvalue->variable () &&
625- isDeadTemporary (tokvalue, tok, & mSettings ->library )) {
625+ isDeadTemporary (tokvalue, tok, mSettings ->library )) {
626626 if (!diag (tokvalue))
627627 errorDanglingTemporaryLifetime (tok, &val, tokvalue);
628628 break ;
0 commit comments