From a5bdec0156282b7ddde977907dcbe2456bbd5211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 30 Sep 2024 09:40:52 +0200 Subject: [PATCH] fix --- lib/checkautovariables.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 4c4b9e69135..c7e3b16e5ba 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -562,7 +562,7 @@ void CheckAutoVariables::checkVarLifetimeScope(const Token * start, const Token errorReturnReference(tok, lt.errorPath, lt.inconclusive); break; } - if (isDeadTemporary(lt.token, nullptr, &mSettings->library)) { + if (isDeadTemporary(lt.token, nullptr, &mSettings->library) && lt.token->variable() && lt.token->variable()->isReference()) { errorReturnTempReference(tok, lt.errorPath, lt.inconclusive); break; }