Don't care which type protected operator= returns

This commit is contained in:
Dmitry-Me 2014-12-26 15:38:22 +01:00 committed by Daniel Marjamäki
parent 6194a4eefd
commit 14f13afa0a
2 changed files with 8 additions and 1 deletions

View File

@ -1117,7 +1117,7 @@ void CheckClass::operatorEq()
std::list<Function>::const_iterator func; std::list<Function>::const_iterator func;
for (func = scope->functionList.begin(); func != scope->functionList.end(); ++func) { for (func = scope->functionList.begin(); func != scope->functionList.end(); ++func) {
if (func->type == Function::eOperatorEqual && func->access != Private) { if (func->type == Function::eOperatorEqual && func->access == Public) {
// skip "deleted" functions - cannot be called anyway // skip "deleted" functions - cannot be called anyway
if (func->isDelete) if (func->isDelete)
continue; continue;

View File

@ -572,6 +572,13 @@ private:
"};"); "};");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkOpertorEq("class A\n"
"{\n"
"protected:\n"
" void operator=(const A&);\n"
"};");
ASSERT_EQUALS("", errout.str());
checkOpertorEq("class A\n" checkOpertorEq("class A\n"
"{\n" "{\n"
"private:\n" "private:\n"