Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,9 @@ void TokenList::validateAst(bool print) const
if ((tok->isAssignmentOp() || tok->isComparisonOp() || Token::Match(tok,"[|^/%]")) && tok->astOperand1() && !tok->astOperand2())
throw InternalError(tok, "Syntax Error: AST broken, binary operator has only one operand.", InternalError::AST);

if (!(tok->astOperand1() && tok->astOperand2()) && ((isC() && tok->str() == "&&") || Token::Match(tok, "%or%|%oror%")))
throw InternalError(tok, "Syntax Error: AST broken, binary operator is missing operand(s).", InternalError::AST);

// Syntax error if we encounter "?" with operand2 that is not ":"
if (tok->str() == "?") {
if (!tok->astOperand1() || !tok->astOperand2())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
n(f=n){n&&,n}
Loading