Fixed #3496 (false positive: syntax error)
This commit is contained in:
parent
461565c50a
commit
a6d96f5b72
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue