Fixed #8232 (segmentation fault on valid C++ code in isOppositeCond())

This commit is contained in:
Daniel Marjamäki 2018-09-04 18:10:31 +02:00
parent 361ae311f6
commit 3a8bdad20a
2 changed files with 4 additions and 0 deletions

View File

@ -391,6 +391,9 @@ static bool iscast(const Token *tok)
if (!Token::Match(tok, "( ::| %name%"))
return false;
if (Token::simpleMatch(tok->link(), ") ( )"))
return false;
if (tok->previous() && tok->previous()->isName() && tok->previous()->str() != "return")
return false;

View File

@ -8500,6 +8500,7 @@ private:
// not cast
ASSERT_EQUALS("AB||", testAst("(A)||(B)"));
ASSERT_EQUALS("abc[1&=", testAst("a = (b[c]) & 1;"));
ASSERT_EQUALS("abc::(=", testAst("a = (b::c)();"));
}
void astlambda() {