diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 2b80383d54a..0b5f7b3f9e4 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -3012,7 +3012,8 @@ static std::vector getDuplInheritedMemberFunctionsRecursive( (parentClassFuncIt.access != AccessControl::Private || !skipPrivate) && !classFuncIt.isConstructor() && !classFuncIt.isDestructor() && classFuncIt.argsMatch(parentClassIt.type->classScope, parentClassFuncIt.argDef, classFuncIt.argDef, emptyString, 0) && - (classFuncIt.isConst() == parentClassFuncIt.isConst() || Function::returnsConst(&classFuncIt) == Function::returnsConst(&parentClassFuncIt))) + (classFuncIt.isConst() == parentClassFuncIt.isConst() || Function::returnsConst(&classFuncIt) == Function::returnsConst(&parentClassFuncIt)) && + !(classFuncIt.isDelete() || parentClassFuncIt.isDelete())) results.emplace_back(&classFuncIt, &parentClassFuncIt, &parentClassIt); } } diff --git a/test/testclass.cpp b/test/testclass.cpp index 785b6fcf005..b132aa726b4 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -713,6 +713,17 @@ class TestClass : public TestFixture { " const int& get() const { return i; }\n" "};\n"); ASSERT_EQUALS("", errout.str()); + + checkDuplInheritedMembers("class Base {\n" // #12353 + " public:\n" + " void One();\n" + " void Two();\n" + "};\n" + "class Derived : public Base {\n" + "public:\n" + " void Two() = delete;\n" + "};\n"); + ASSERT_EQUALS("", errout.str()); } #define checkCopyConstructor(code) checkCopyConstructor_(code, __FILE__, __LINE__)