From 6275aa2485aadddd57bf82827f89133105864b27 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:20:31 +0200 Subject: [PATCH] Update checkclass.cpp --- lib/checkclass.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index f8b67684cf5..91a79e51ca8 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -3327,8 +3327,14 @@ static const Variable* getSingleReturnVar(const Scope* scope) { if (!start->astOperand1() || start->str() != "return") return nullptr; const Token* tok = start->astOperand1(); - if (tok->str() == ".") + if (tok->str() == ".") { + const Token* top = tok->astOperand1(); + while (Token::Match(top, "[[.]")) + top = top->astOperand1(); + if (!Token::Match(top, "%var%")) + return nullptr; tok = tok->astOperand2(); + } return tok->variable(); }