Skip to content

Commit 05bd396

Browse files
Update tokenlist.cpp
1 parent b6e1f45 commit 05bd396

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/tokenlist.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,9 @@ void TokenList::validateAst(bool print) const
19461946
// Syntax error if binary operator only has 1 operand
19471947
if ((tok->isAssignmentOp() || tok->isComparisonOp() || Token::Match(tok,"[|^/%]")) && tok->astOperand1() && !tok->astOperand2())
19481948
throw InternalError(tok, "Syntax Error: AST broken, binary operator has only one operand.", InternalError::AST);
1949+
1950+
if (isC() && !(tok->astOperand1() && tok->astOperand2()) && Token::Match(tok, "&&|%or%|%oror%"))
1951+
throw InternalError(tok, "Syntax Error: AST broken, binary operator is missing operand(s).", InternalError::AST);
19491952

19501953
// Syntax error if we encounter "?" with operand2 that is not ":"
19511954
if (tok->str() == "?") {

0 commit comments

Comments
 (0)