fix #3004 (false positive: (style) Struct 'Fred' hides typedef with same name)

This commit is contained in:
Robert Reif 2011-08-14 21:00:05 -04:00
parent 08e9d64a86
commit ed507b73ee
2 changed files with 13 additions and 1 deletions

View File

@ -721,7 +721,7 @@ bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name, const Token
duplicateTypedefError(*tokPtr, name, "Struct");
return true;
}
else if (tok->next()->str() == ")")
else if (Token::Match(tok->next(), ")|*"))
{
return true;
}

View File

@ -267,6 +267,7 @@ private:
TEST_CASE(simplifyTypedef99); // ticket #2999
TEST_CASE(simplifyTypedef100); // ticket #3000
TEST_CASE(simplifyTypedef101); // ticket #3003 (segmentation fault)
TEST_CASE(simplifyTypedef102); // ticket #3004
TEST_CASE(simplifyTypedefFunction1);
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
@ -5393,6 +5394,17 @@ private:
ASSERT_EQUALS("[test.cpp:2]: (error) syntax error\n", errout.str());
}
void simplifyTypedef102() // ticket #3004
{
const char code[] = "typedef struct { } Fred;\n"
"void foo()\n"
"{\n"
" Fred * Fred;\n"
"}\n";
sizeof_(code);
ASSERT_EQUALS("", errout.str());
}
void simplifyTypedefFunction1()
{
{