Merge branch 'master' of http://github.com/danmar/cppcheck
This commit is contained in:
commit
57a6775a2d
|
@ -924,6 +924,7 @@ void CheckClass::checkReturnPtrThis(const Scope *scope, const Function *func, co
|
||||||
else if (!(Token::Match(tok->tokAt(1), "(| * this ;|=") ||
|
else if (!(Token::Match(tok->tokAt(1), "(| * this ;|=") ||
|
||||||
Token::Match(tok->tokAt(1), "(| * this +=") ||
|
Token::Match(tok->tokAt(1), "(| * this +=") ||
|
||||||
Token::simpleMatch(tok->tokAt(1), "operator= (") ||
|
Token::simpleMatch(tok->tokAt(1), "operator= (") ||
|
||||||
|
Token::simpleMatch(tok->tokAt(1), "this . operator= (") ||
|
||||||
(Token::Match(tok->tokAt(1), "%type% :: operator= (") &&
|
(Token::Match(tok->tokAt(1), "%type% :: operator= (") &&
|
||||||
tok->next()->str() == scope->className)))
|
tok->next()->str() == scope->className)))
|
||||||
operatorEqRetRefThisError(func->token);
|
operatorEqRetRefThisError(func->token);
|
||||||
|
|
|
@ -452,6 +452,16 @@ private:
|
||||||
"A &A::operator =(int *other) { return (*this;) };\n"
|
"A &A::operator =(int *other) { return (*this;) };\n"
|
||||||
"A &A::operator =(long *other) { return operator = (*(int *)other); };");
|
"A &A::operator =(long *other) { return operator = (*(int *)other); };");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkOpertorEqRetRefThis(
|
||||||
|
"class A {\n"
|
||||||
|
"public:\n"
|
||||||
|
" A &operator =(int *other);\n"
|
||||||
|
" A &operator =(long *other);\n"
|
||||||
|
"};\n"
|
||||||
|
"A &A::operator =(int *other) { return (*this;) };\n"
|
||||||
|
"A &A::operator =(long *other) { return this->operator = (*(int *)other); };");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void operatorEqRetRefThis4()
|
void operatorEqRetRefThis4()
|
||||||
|
|
Loading…
Reference in New Issue