fix #2599 (segmentation fault of cppcheck ( sizeof ))

This commit is contained in:
Robert Reif 2011-02-21 17:49:30 -05:00
parent 5f84272a52
commit 999646fca6
2 changed files with 13 additions and 0 deletions

View File

@ -3809,6 +3809,9 @@ void Tokenizer::simplifySizeof()
if (tok->str() != "sizeof")
continue;
if (!tok->next())
break;
if (Token::simpleMatch(tok->next(), "sizeof"))
continue;

View File

@ -84,6 +84,7 @@ private:
TEST_CASE(sizeof19); // #1891 - sizeof 'x'
TEST_CASE(sizeof20); // #2024 - sizeof a)
TEST_CASE(sizeof21); // #2232 - sizeof...(Args)
TEST_CASE(sizeof22); // #2599
TEST_CASE(sizeofsizeof);
TEST_CASE(casting);
@ -1418,6 +1419,15 @@ private:
tok(code);
}
void sizeof22()
{
// ticket #2599 segmentation fault
const char code[] = "sizeof\n";
// don't segfault
tok(code);
}
void sizeofsizeof()
{