Fixed #1613 (False -s positive: Template instantiation hides typedef with same name)
This commit is contained in:
parent
d90f59051c
commit
bee4608b27
|
@ -495,6 +495,9 @@ bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name)
|
|||
}
|
||||
else if (tok->previous()->str() == ">")
|
||||
{
|
||||
if (!Token::Match(tok->tokAt(-2), "%type%"))
|
||||
return false;
|
||||
|
||||
duplicateTypedefError(*tokPtr, name, "Template instantiation");
|
||||
*tokPtr = end->link();
|
||||
return true;
|
||||
|
|
|
@ -183,6 +183,7 @@ private:
|
|||
TEST_CASE(simplifyTypedef42); // ticket #1506
|
||||
TEST_CASE(simplifyTypedef43); // ticket #1588
|
||||
TEST_CASE(simplifyTypedef44);
|
||||
TEST_CASE(simplifyTypedef45); // ticket #1613
|
||||
|
||||
TEST_CASE(reverseArraySyntax)
|
||||
TEST_CASE(simplify_numeric_condition)
|
||||
|
@ -3877,6 +3878,18 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void simplifyTypedef45()
|
||||
{
|
||||
// ticket # 1613
|
||||
const char code[] = "void fn() {\n"
|
||||
" typedef foo<> bar;\n"
|
||||
" while (0 > bar(1)) {}\n"
|
||||
"}";
|
||||
|
||||
checkSimplifyTypedef(code);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void reverseArraySyntax()
|
||||
{
|
||||
ASSERT_EQUALS("a [ 13 ]", tok("13[a]"));
|
||||
|
|
Loading…
Reference in New Issue