fix #3007 (false positive: (style) Struct 'Fred' hides typedef with same name)
This commit is contained in:
parent
ed507b73ee
commit
5364b4f7fb
|
@ -725,6 +725,10 @@ bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name, const Token
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if (tok->next()->str() == name->str())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (tok->next()->str() != ";")
|
||||
{
|
||||
duplicateTypedefError(*tokPtr, name, "Struct");
|
||||
|
|
|
@ -268,6 +268,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef100); // ticket #3000
|
||||
TEST_CASE(simplifyTypedef101); // ticket #3003 (segmentation fault)
|
||||
TEST_CASE(simplifyTypedef102); // ticket #3004
|
||||
TEST_CASE(simplifyTypedef103); // ticket #3007
|
||||
|
||||
TEST_CASE(simplifyTypedefFunction1);
|
||||
TEST_CASE(simplifyTypedefFunction2); // ticket #1685
|
||||
|
@ -5405,6 +5406,17 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedef103() // ticket #3007
|
||||
{
|
||||
const char code[] = "typedef struct { } Fred;\n"
|
||||
"void foo()\n"
|
||||
"{\n"
|
||||
" Fred Fred;\n"
|
||||
"}\n";
|
||||
sizeof_(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void simplifyTypedefFunction1()
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue