Fix 10420: assertion error when analysing juce (#3413)

This commit is contained in:
Paul Fultz II 2021-08-23 04:12:42 -05:00 committed by GitHub
parent 865163b2ba
commit 524db1c756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -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<Token*>(nextExpression), endOfVarScope, parent->astOperand1(), values, tokenlist, settings);

View File

@ -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 = &comp;\n"
" o.isWatchingForDeletion = true;\n"
" return o;\n"
"}}\n";
valueOfTok(code, "return");
}
void valueFlowCrash() {