diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 37afc347e..28cee8873 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -3271,7 +3271,7 @@ static void valueFlowForwardLifetime(Token * tok, TokenList *tokenlist, ErrorLog // Skip RHS const Token *nextExpression = nextAfterAstRightmostLeaf(parent); - if (Token::Match(parent->astOperand1(), ".|[|(")) { + if (Token::Match(parent->astOperand1(), ".|[|(") && parent->astOperand1()->exprId() > 0) { valueFlowForwardExpression( const_cast(nextExpression), endOfVarScope, parent->astOperand1(), values, tokenlist, settings); diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 41e3393c2..546d0e872 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -5659,6 +5659,16 @@ private: " };\n" "}\n"; valueOfTok(code, "0"); + + code = "namespace juce {\n" + "PopupMenu::Item& PopupMenu::Item::operator= (Item&&) = default;\n" + "PopupMenu::Options withDeletionCheck (Component& comp) const {\n" + " Options o (*this);\n" + " o.componentToWatchForDeletion = ∁\n" + " o.isWatchingForDeletion = true;\n" + " return o;\n" + "}}\n"; + valueOfTok(code, "return"); } void valueFlowCrash() {