Fixed #1801 (Segmentation fault while scanning Qt's qcups.cpp)
This commit is contained in:
parent
ad4681223b
commit
f116e74f6e
|
@ -1008,7 +1008,8 @@ void Tokenizer::simplifyTypedef()
|
|||
}
|
||||
|
||||
// function returning pointer to function
|
||||
else if (tok->tokAt(offset) && Token::Match(tok->tokAt(offset), "( * %type% ("))
|
||||
else if (tok->tokAt(offset) && Token::Match(tok->tokAt(offset), "( * %type% (") &&
|
||||
Token::Match(tok->tokAt(offset + 3)->link(), ") ) ("))
|
||||
{
|
||||
functionRetFuncPtr = true;
|
||||
|
||||
|
|
|
@ -203,6 +203,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef50);
|
||||
TEST_CASE(simplifyTypedef51);
|
||||
TEST_CASE(simplifyTypedef52); // ticket #1782
|
||||
TEST_CASE(simplifyTypedef53); // ticket #1801
|
||||
|
||||
TEST_CASE(simplifyTypedefFunction1);
|
||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||
|
@ -4179,6 +4180,17 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void simplifyTypedef53() // ticket #1801
|
||||
{
|
||||
{
|
||||
const char code[] = "typedef int ( * int ( * ) ( ) ) ( ) ;";
|
||||
|
||||
// this is invalid C so just make sure it doesn't crash
|
||||
checkSimplifyTypedef(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue