Fixed #2015 (### Internal error in Cppcheck. Please report it.)
This commit is contained in:
parent
9415423352
commit
75fb99cee7
|
@ -5602,6 +5602,10 @@ Token * Tokenizer::initVar(Token * tok)
|
|||
if (tok->str() == "*")
|
||||
tok = tok->next();
|
||||
|
||||
// sizeof is not a variable name..
|
||||
if (tok->str() == "sizeof")
|
||||
return tok;
|
||||
|
||||
// check initializer..
|
||||
if (tok->tokAt(2)->isStandardType() || tok->tokAt(2)->str() == "void")
|
||||
return tok;
|
||||
|
|
|
@ -49,6 +49,7 @@ private:
|
|||
TEST_CASE(tokenize8);
|
||||
TEST_CASE(tokenize9);
|
||||
TEST_CASE(tokenize10);
|
||||
TEST_CASE(tokenize11);
|
||||
|
||||
// array access. replace "*(p+1)" => "p[1]"
|
||||
TEST_CASE(tokenize6);
|
||||
|
@ -423,6 +424,11 @@ private:
|
|||
ASSERT_EQUALS("__published:", tokenizeAndStringify("__published:", false));
|
||||
}
|
||||
|
||||
void tokenize11()
|
||||
{
|
||||
ASSERT_EQUALS("X * sizeof ( Y ( ) ) ;", tokenizeAndStringify("X * sizeof(Y());", false));
|
||||
}
|
||||
|
||||
void wrong_syntax()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue