parent
73187e6e12
commit
f24c7fdae9
|
@ -2988,7 +2988,8 @@ static std::vector<DuplMemberFuncInfo> getDuplInheritedMemberFunctionsRecursive(
|
|||
if (classFuncIt.name() == parentClassFuncIt.name() &&
|
||||
(parentClassFuncIt.access != AccessControl::Private || !skipPrivate) &&
|
||||
!classFuncIt.isConstructor() && !classFuncIt.isDestructor() &&
|
||||
classFuncIt.argsMatch(parentClassIt.type->classScope, parentClassFuncIt.argDef, classFuncIt.argDef, emptyString, 0))
|
||||
classFuncIt.argsMatch(parentClassIt.type->classScope, parentClassFuncIt.argDef, classFuncIt.argDef, emptyString, 0) &&
|
||||
(classFuncIt.isConst() == parentClassFuncIt.isConst() || Function::returnsConst(&classFuncIt) == Function::returnsConst(&parentClassFuncIt)))
|
||||
results.emplace_back(&classFuncIt, &parentClassFuncIt, &parentClassIt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -704,6 +704,14 @@ private:
|
|||
" T* operator->() const { return (T*)p; }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkDuplInheritedMembers("struct B { virtual int& get() = 0; };\n" // #12311
|
||||
"struct D : B {\n"
|
||||
" int i{};\n"
|
||||
" int& get() override { return i; }\n"
|
||||
" const int& get() const { return i; }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
#define checkCopyConstructor(code) checkCopyConstructor_(code, __FILE__, __LINE__)
|
||||
|
|
Loading…
Reference in New Issue