Tokenizer: Detect more syntax errors when operator does not have operands
This commit is contained in:
parent
dbbb7f544a
commit
7e0fc4fb00
|
@ -9439,6 +9439,8 @@ void Tokenizer::findGarbageCode() const
|
|||
if (!Token::Match(tok->next(), "%name%|*|~"))
|
||||
syntaxError(tok, tok->strAt(-1) + " " + tok->str() + " " + tok->strAt(1));
|
||||
}
|
||||
if (Token::Match(tok, "[!|+-/%^~] )|]"))
|
||||
syntaxError(tok);
|
||||
}
|
||||
|
||||
// ternary operator without :
|
||||
|
|
|
@ -1010,7 +1010,7 @@ private:
|
|||
}
|
||||
|
||||
void garbageCode132() { // #7022
|
||||
checkCode("() () { } { () () ({}) i() } void i(void(*ptr) ()) { ptr(!) () }");
|
||||
ASSERT_THROW(checkCode("() () { } { () () ({}) i() } void i(void(*ptr) ()) { ptr(!) () }"), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode133() {
|
||||
|
@ -1247,7 +1247,7 @@ private:
|
|||
}
|
||||
|
||||
void garbageCode159() { // #7119
|
||||
checkCode("({}typedef typename x;typename x!){({{}()})}"); // don't hang
|
||||
ASSERT_THROW(checkCode("({}typedef typename x;typename x!){({{}()})}"), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode160() { // #7190
|
||||
|
|
Loading…
Reference in New Issue