Fixed #4786 (segfault with one LibreOffice file)

This commit is contained in:
Daniel Marjamäki 2013-05-06 16:56:34 +02:00
parent 3f5a858800
commit 4659745106
2 changed files with 7 additions and 1 deletions

View File

@ -7985,7 +7985,7 @@ void Tokenizer::simplifyComma()
// Handle "delete a, a = 0;" // Handle "delete a, a = 0;"
tok->str(";"); tok->str(";");
break; break;
} else if (Token::Match(tok2, "[;,{}()]")) { } else if (Token::Match(tok2, "[:;,{}()]")) {
break; break;
} }
} }

View File

@ -2733,6 +2733,12 @@ private:
"}\n"; "}\n";
ASSERT_EQUALS("void f ( ) { char buf [ BUFSIZ ] ; char * * p ; char * ptrs [ BUFSIZ ] ; char * * pp ; }", tok(code)); ASSERT_EQUALS("void f ( ) { char buf [ BUFSIZ ] ; char * * p ; char * ptrs [ BUFSIZ ] ; char * * pp ; }", tok(code));
} }
{
// #4786 - don't replace , with ; in ".. : public B, C .." code
const char code[] = "template < class T = X > class A : public B , C { } ;";
ASSERT_EQUALS(code, tok(code));
}
} }
void remove_comma() { void remove_comma() {