From 14f13afa0aa9301d2065cf6d0dad3c0797ded7ad Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Fri, 26 Dec 2014 15:38:22 +0100 Subject: [PATCH] Don't care which type protected operator= returns --- lib/checkclass.cpp | 2 +- test/testclass.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 3b10fa31b..8a6d06c27 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1117,7 +1117,7 @@ void CheckClass::operatorEq() std::list::const_iterator 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 if (func->isDelete) continue; diff --git a/test/testclass.cpp b/test/testclass.cpp index 09b24ddfc..b8a594b0b 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -572,6 +572,13 @@ private: "};"); ASSERT_EQUALS("", errout.str()); + checkOpertorEq("class A\n" + "{\n" + "protected:\n" + " void operator=(const A&);\n" + "};"); + ASSERT_EQUALS("", errout.str()); + checkOpertorEq("class A\n" "{\n" "private:\n"