Fixed #1673 (Tokenizer::simplifyTypedef causes segfault for boost library)

This commit is contained in:
Robert Reif 2010-05-17 19:58:27 +02:00 committed by Daniel Marjamäki
parent f8442391af
commit 9dfbd3946a
2 changed files with 19 additions and 1 deletions

View File

@ -1019,7 +1019,7 @@ void Tokenizer::simplifyTypedef()
}
}
}
else
else if (tok2->previous()->str() != ".")
{
simplifyType = true;
}

View File

@ -190,6 +190,7 @@ private:
TEST_CASE(simplifyTypedef45); // ticket #1613
TEST_CASE(simplifyTypedef46); // ticket #1615
TEST_CASE(simplifyTypedef47);
TEST_CASE(simplifyTypedef48); // ticket #1673
TEST_CASE(simplifyTypedefFunction);
@ -3970,6 +3971,23 @@ private:
}
}
void simplifyTypedef48() // ticket #1673
{
const char code[] = "typedef struct string { } string;\n"
"void foo (LIST *module_name)\n"
"{\n"
" bar(module_name ? module_name->string : 0);\n"
"}\n";
// The expected result..
const std::string expected("struct string { } ; ; "
"void foo ( LIST * module_name ) "
"{ "
"bar ( module_name ? module_name . string : 0 ) ; "
"}");
ASSERT_EQUALS(expected, sizeof_(code));
}
void simplifyTypedefFunction()
{
{