fix #2983 (segmentation fault of cppcheck)
This commit is contained in:
parent
2b8b0c44b2
commit
10eb224ac7
|
@ -1773,7 +1773,7 @@ void Tokenizer::simplifyTypedef()
|
||||||
// don't add parenthesis around function names because it
|
// don't add parenthesis around function names because it
|
||||||
// confuses other simplifications
|
// confuses other simplifications
|
||||||
bool needParen = true;
|
bool needParen = true;
|
||||||
if (!inTemplate && function && tok2->next()->str() != "*")
|
if (!inTemplate && function && tok2->next() && tok2->next()->str() != "*")
|
||||||
needParen = false;
|
needParen = false;
|
||||||
if (needParen)
|
if (needParen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -262,6 +262,7 @@ private:
|
||||||
TEST_CASE(simplifyTypedef94); // ticket #1982
|
TEST_CASE(simplifyTypedef94); // ticket #1982
|
||||||
TEST_CASE(simplifyTypedef95); // ticket #2844
|
TEST_CASE(simplifyTypedef95); // ticket #2844
|
||||||
TEST_CASE(simplifyTypedef96); // ticket #2886
|
TEST_CASE(simplifyTypedef96); // ticket #2886
|
||||||
|
TEST_CASE(simplifyTypedef97); // ticket #2983 (segmentation fault)
|
||||||
|
|
||||||
TEST_CASE(simplifyTypedefFunction1);
|
TEST_CASE(simplifyTypedefFunction1);
|
||||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||||
|
@ -5338,6 +5339,14 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyTypedef97() // ticket #2983 (segmentation fault)
|
||||||
|
{
|
||||||
|
const char code[] = "typedef x y\n"
|
||||||
|
"(A); y\n";
|
||||||
|
sizeof_(code);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyTypedefFunction1()
|
void simplifyTypedefFunction1()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue