Fixed #1405 (false positive: operator = should return reference to itself)
This commit is contained in:
parent
db2c362604
commit
deb71fc566
|
@ -5323,9 +5323,10 @@ void Tokenizer::simplifyEnum()
|
|||
}
|
||||
else if (inScope && !exitThisScope && tok2->str() == enumName->str())
|
||||
{
|
||||
if (Token::simpleMatch(tok2->previous(), "::"))
|
||||
if (Token::simpleMatch(tok2->previous(), "::") ||
|
||||
(tok2->next() && Token::simpleMatch(tok2->next(), "::")))
|
||||
{
|
||||
// Don't replace this enum if it's preceded by "::"
|
||||
// Don't replace this enum if it's preceded or followed by "::"
|
||||
}
|
||||
else if (!duplicateDefinition(&tok2, enumName))
|
||||
{
|
||||
|
|
|
@ -191,6 +191,7 @@ private:
|
|||
TEST_CASE(enum6);
|
||||
TEST_CASE(enum7);
|
||||
TEST_CASE(enum8);
|
||||
TEST_CASE(enum9); // ticket 1404
|
||||
|
||||
// remove "std::" on some standard functions
|
||||
TEST_CASE(removestd);
|
||||
|
@ -3596,6 +3597,22 @@ private:
|
|||
"[test.cpp:23] -> [test.cpp:1]: (style) Template parameter 'S' hides enumerator of same name\n", errout.str());
|
||||
}
|
||||
|
||||
void enum9()
|
||||
{
|
||||
// ticket 1404
|
||||
checkSimplifyEnum("class XX {\n"
|
||||
"public:\n"
|
||||
"static void Set(const int &p){m_p=p;}\n"
|
||||
"static int m_p;\n"
|
||||
"};\n"
|
||||
"int XX::m_p=0;\n"
|
||||
"int main() {\n"
|
||||
" enum { XX };\n"
|
||||
" XX::Set(std::numeric_limits<X>::digits());\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void removestd()
|
||||
{
|
||||
ASSERT_EQUALS("; strcpy ( a , b ) ;", tok("; std::strcpy(a,b);"));
|
||||
|
|
Loading…
Reference in New Issue