Fixed #3496 (false positive: syntax error)

This commit is contained in:
Daniel Marjamäki 2012-01-15 14:33:53 +01:00
parent 461565c50a
commit a6d96f5b72
2 changed files with 7 additions and 2 deletions

View File

@ -76,7 +76,7 @@ const Token* TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates(Token *to
// check for more complicated syntax errors when using templates..
for (const Token *tok = tokens; tok; tok = tok->next()) {
// skip executing scopes..
if (Token::Match(tok, ") const| {") || Token::Match(tok, "[,=] {")) {
if (Token::simpleMatch(tok, ") {") || Token::Match(tok, ") %var% {") || Token::Match(tok, "[,=] {")) {
while (tok->str() != "{")
tok = tok->next();
tok = tok->link();

View File

@ -598,8 +598,13 @@ private:
ASSERT_EQUALS("( X && Y )", tokenizeAndStringify("(X&&Y)"));
}
void tokenize19() { // #3006 (segmentation fault)
void tokenize19() {
// #3006 - added hasComplicatedSyntaxErrorsInTemplates to avoid segmentation fault
tokenizeAndStringify("x < () <");
// #3496 - make sure hasComplicatedSyntaxErrorsInTemplates works
ASSERT_EQUALS("void a ( Fred * f ) { for ( ; n < f . x ( ) ; ) { } }",
tokenizeAndStringify("void a(Fred* f) MACRO { for (;n < f->x();) {} }"));
}
void tokenize20() { // replace C99 _Bool => bool