Fixed false positive #5535: Reference named like its type.

This commit is contained in:
PKEuS 2014-03-17 12:01:39 +01:00
parent 50f6bb5d36
commit d325d14b11
2 changed files with 5 additions and 1 deletions

View File

@ -68,7 +68,7 @@ static bool isSameExpression(const Token *tok1, const Token *tok2, const std::se
return true; return true;
if (tok1 == nullptr || tok2 == nullptr) if (tok1 == nullptr || tok2 == nullptr)
return false; return false;
if (tok1->str() != tok2->str()) if (tok1->str() != tok2->str() || tok1->varId() != tok2->varId())
return false; return false;
if (tok1->isExpandedMacro() || tok2->isExpandedMacro()) if (tok1->isExpandedMacro() || tok2->isExpandedMacro())
return false; return false;

View File

@ -4729,6 +4729,10 @@ private:
// make sure there are not "same expression" fp when there are different ({}) expressions // make sure there are not "same expression" fp when there are different ({}) expressions
check("void f(long x) { if (({ 1+2; }) == ({3+4};)) {} }"); check("void f(long x) { if (({ 1+2; }) == ({3+4};)) {} }");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
// #5535: Reference named like its type
check("void foo() { UMSConfig& UMSConfig = GetUMSConfiguration(); }");
ASSERT_EQUALS("", errout.str());
} }
void duplicateIf1() { // ticket 3689 ( avoid false positive ) void duplicateIf1() { // ticket 3689 ( avoid false positive )