This commit is contained in:
parent
0005be1dbf
commit
58d7185d64
|
@ -2266,6 +2266,8 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
|
|||
return false;
|
||||
if (Token::Match(tok1->previous(), "( this . * %var% )")) // call using ptr to member function TODO: check constness
|
||||
return false;
|
||||
if (Token::simpleMatch(tok1->astParent(), "*") && tok1->astParent()->astParent() && tok1->astParent()->astParent()->isIncDecOp())
|
||||
return false;
|
||||
}
|
||||
|
||||
// non const pointer cast
|
||||
|
|
|
@ -6245,6 +6245,14 @@ private:
|
|||
" void nextA() { return a--; }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (performance, inconclusive) Technically the member function 'Fred::nextA' can be static (but you may consider moving to unnamed namespace).\n", errout.str());
|
||||
|
||||
checkConst("struct S {\n" // #10077
|
||||
" int i{};\n"
|
||||
" S& operator ++() { ++i; return *this; }\n"
|
||||
" S operator ++(int) { S s = *this; ++(*this); return s; }\n"
|
||||
" void f() { (*this)--; }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void constassign1() {
|
||||
|
|
Loading…
Reference in New Issue